Merge branch 'master' into 'AddFeatureClass'
# Conflicts: # src/Server/src/main/java/greenify/server/data/model/User.java # src/Server/src/main/java/greenify/server/service/UserService.java
This commit is contained in:
@@ -11,6 +11,7 @@ apply plugin: 'java'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'jacoco'
|
||||
apply plugin: 'checkstyle'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
@@ -19,6 +20,22 @@ repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
def configDir = "${project.rootDir}/quality"
|
||||
|
||||
checkstyle {
|
||||
toolVersion '7.8.1'
|
||||
configFile file("$configDir/checkstyle/checkstyle.xml")
|
||||
configProperties.checkstyleSuppressionsPath = file("$configDir/checkstyle/suppressions.xml").absolutePath
|
||||
}
|
||||
|
||||
checkstyleMain {
|
||||
source ='src/main/java'
|
||||
}
|
||||
|
||||
checkstyleTest {
|
||||
source ='src/test/java'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testCompile("junit:junit")
|
||||
testCompile(
|
||||
@@ -42,4 +59,4 @@ jacocoTestReport {
|
||||
csv.enabled false
|
||||
html.destination file("${buildDir}/jacocoHtml")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ public class ErrorResponse {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ErrorResponse() { }
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
@@ -14,4 +16,4 @@ public class ErrorResponse {
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package greenify.common;
|
||||
|
||||
public class UserDTO {
|
||||
private Long id;
|
||||
private String name;
|
||||
|
||||
public UserDTO() {
|
||||
}
|
||||
|
||||
public UserDTO(Long id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
34
src/Common/src/main/java/greenify/common/UserDto.java
Normal file
34
src/Common/src/main/java/greenify/common/UserDto.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package greenify.common;
|
||||
|
||||
// DTO stands for Data Transfer Object.
|
||||
// is an object that carries data between processes.
|
||||
// The motivation for its use is that communication between processes is usually done
|
||||
// resorting to remote interfaces (e.g., web services), where each call is an expensive operation.
|
||||
public class UserDto {
|
||||
private Long id;
|
||||
private String name;
|
||||
|
||||
public UserDto() {
|
||||
}
|
||||
|
||||
public UserDto(Long id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
24
src/Common/src/test/java/ErrorResponseTest.java
Normal file
24
src/Common/src/test/java/ErrorResponseTest.java
Normal file
@@ -0,0 +1,24 @@
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import greenify.common.ErrorResponse;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
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 static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import greenify.common.UserDto;
|
||||
import org.junit.Test;
|
||||
|
||||
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