Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,11 @@
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
7 changes: 7 additions & 0 deletions src/main/java/com/github/curriculeon/MainApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.github.curriculeon;

public class MainApplication {
public static void main(String[] args) {

}
}
18 changes: 18 additions & 0 deletions src/main/java/com/github/curriculeon/Person.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
36 changes: 36 additions & 0 deletions src/test/java/PersonTest.java
Original file line number Diff line number Diff line change
@@ -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);
}

}
5 changes: 0 additions & 5 deletions src/test/java/com/github/curriculeon/TestPerson.java

This file was deleted.