Add new tests

This commit is contained in:
cugurlu
2019-03-16 14:18:40 +01:00
parent 59c84f2c09
commit 479ed8e7f2
5 changed files with 122 additions and 70 deletions

View 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()));
}
}

View 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());
}
}