Add new tests
This commit is contained in:
23
src/Common/src/test/java/ErrorResponseTest.java
Normal file
23
src/Common/src/test/java/ErrorResponseTest.java
Normal file
@@ -0,0 +1,23 @@
|
||||
import greenify.common.ErrorResponse;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ErrorResponseTest {
|
||||
@Test
|
||||
public void setAndGetTest() {
|
||||
ErrorResponse response = new ErrorResponse("New error");
|
||||
ErrorResponse testResponse = new ErrorResponse();
|
||||
testResponse.setMessage("New error");
|
||||
assertTrue(response.getMessage().equals("New error"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equalsTest() {
|
||||
ErrorResponse first = new ErrorResponse("New error");
|
||||
ErrorResponse second = new ErrorResponse("New error");
|
||||
assertEquals(first.getMessage(), second.getMessage());
|
||||
assertTrue(first.getMessage().equals(second.getMessage()));
|
||||
}
|
||||
}
|
||||
25
src/Common/src/test/java/UserDTOTest.java
Normal file
25
src/Common/src/test/java/UserDTOTest.java
Normal file
@@ -0,0 +1,25 @@
|
||||
import greenify.common.UserDTO;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class UserDTOTest {
|
||||
@Test
|
||||
public void setAndGetTest() {
|
||||
UserDTO user = new UserDTO(1L, "greenify");
|
||||
UserDTO testUser = new UserDTO();
|
||||
testUser.setId(1L);
|
||||
testUser.setName("greenify");
|
||||
assertTrue(user.getId() == 1L);
|
||||
assertEquals(user.getName(), "greenify");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equalsTest() {
|
||||
UserDTO first = new UserDTO(1L, "greenify");
|
||||
UserDTO second = new UserDTO(1L, "greenify");
|
||||
assertEquals(first.getId(), second.getId());
|
||||
assertEquals(first.getName(), second.getName());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user