Skip to content

Instantly share code, notes, and snippets.

@joshden joshden/PersonTest.java
Last active Nov 17, 2018

Embed
What would you like to do?
Simple example of unit test class for JUnit 4
package com.example;
import org.junit.Test;
import static org.junit.Assert.*;
public class PersonTest {
@Test
public void testGetDisplayName() {
Person person = new Person("Josh", "Hayden");
String displayName = person.getDisplayName();
assertEquals("Hayden, Josh", displayName);
}
}
@ahmadhosny

This comment has been minimized.

Copy link

ahmadhosny commented Mar 10, 2017

The only difference between this code and the jUnit5 code in your Toptal blog post is the public modifier. Correct?

@darshitpp

This comment has been minimized.

Copy link

darshitpp commented Nov 17, 2018

The only difference between this code and the jUnit5 code in your Toptal blog post is the public modifier. Correct?

Yeah, looks like it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.