diff --git a/pom.xml b/pom.xml index aa0b434..663507d 100644 --- a/pom.xml +++ b/pom.xml @@ -27,5 +27,11 @@ 4.12 test + + org.testng + testng + RELEASE + test + diff --git a/src/main/java/com/github/curriculeon/MainApplication.java b/src/main/java/com/github/curriculeon/MainApplication.java new file mode 100644 index 0000000..1d70eb4 --- /dev/null +++ b/src/main/java/com/github/curriculeon/MainApplication.java @@ -0,0 +1,7 @@ +package com.github.curriculeon; + +public class MainApplication { + public static void main(String[] args) { + + } +} diff --git a/src/main/java/com/github/curriculeon/Person.java b/src/main/java/com/github/curriculeon/Person.java index 3c8350b..f8ab018 100644 --- a/src/main/java/com/github/curriculeon/Person.java +++ b/src/main/java/com/github/curriculeon/Person.java @@ -1,5 +1,23 @@ package com.github.curriculeon; public class Person { +private final Long id; +private String name; + public Person(Long id, String name) { + this.id = id; + this.name = name; + } + + public Long getId() { + return id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } } diff --git a/src/test/java/PersonTest.java b/src/test/java/PersonTest.java new file mode 100644 index 0000000..fe06958 --- /dev/null +++ b/src/test/java/PersonTest.java @@ -0,0 +1,36 @@ +import com.github.curriculeon.Person; +import org.junit.Assert; +import org.junit.Test; +import sun.management.snmp.jvminstr.JvmThreadInstanceEntryImpl; + +public class PersonTest { + @Test + public void testConstructor() { + //Given + Long expectedId = 0L; + String expectedName = "Some Name;"; + //When + Person person = new Person(expectedId,expectedName); + Long actualId = person.getId(); + String actualName = person.getName(); + //Then + Assert.assertEquals(expectedId, actualId); + Assert.assertEquals(expectedName, actualName); + + } + @Test + public void testSetName(){ + //Given + Person person = new Person(null,null); + String expectedName = "Some Name"; + Assert.assertNotEquals(expectedName,person.getName()); + + //When + person.setName(expectedName); + String actualName = person.getName(); + + //Then + Assert.assertEquals(expectedName, actualName); + } + +} diff --git a/src/test/java/com/github/curriculeon/TestPerson.java b/src/test/java/com/github/curriculeon/TestPerson.java deleted file mode 100644 index 6c523fe..0000000 --- a/src/test/java/com/github/curriculeon/TestPerson.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.github.curriculeon; - -public class TestPerson { - -}