Created
November 27, 2018 14:25
-
-
Save hw0k/677750bf0253f772771532470d00f313 to your computer and use it in GitHub Desktop.
Writing JUnit Test Case Practice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Person { | |
private String name; | |
private int age; | |
public Person(String name, int age) { | |
this.name = name; | |
this.age = age; | |
} | |
public String getName() { | |
return name; | |
} | |
public void setName(String name) { | |
this.name = name; | |
} | |
public int getAge() { | |
return age; | |
} | |
public void setAge(int age) { | |
this.age = age; | |
} | |
public String getPersonInfo() { | |
return this.name + "님은 " + this.age + "세 입니다."; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.Before; | |
import org.junit.Test; | |
import static org.junit.Assert.*; | |
public class PersonTest { | |
private Person person; | |
@Before | |
public void init() { | |
person = new Person("hw0k", 18); | |
} | |
@Test | |
public void testGetPersonInfo() { | |
assertEquals(person.getPersonInfo(), "hw0k님은 18세 입니다."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment