diff --git a/CSE1105.checkstyle.xml b/CSE1105.checkstyle.xml deleted file mode 100644 index d0fe4b0..0000000 --- a/CSE1105.checkstyle.xml +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build.gradle b/build.gradle index e91d569..2b6ed72 100644 --- a/build.gradle +++ b/build.gradle @@ -16,44 +16,16 @@ apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' -apply plugin: 'jacoco' -apply plugin: 'checkstyle' apply plugin: 'application' application { mainClassName = 'greenify.server.Application' } -tasks.withType(Checkstyle) { - reports { - html.destination rootProject.file("build/reports/checkstyle.html") - } -} - repositories { mavenCentral() } -allprojects { - task hello { - doLast { task -> - println "I'm $task.project.name" - } - } -} - -////client bootjar -//bootJar { -// baseName = 'gs-consuming-rest' -// version = '0.1.0' -//} -// -////server bootjar -//bootJar { -// baseName = 'gs-rest-service' -// version = '0.1.0' -//} - bootJar { enabled = false } @@ -65,10 +37,6 @@ jar { sourceCompatibility = 1.8 targetCompatibility = 1.8 -test { - useJUnitPlatform() -} - dependencies { compile("org.springframework.boot:spring-boot-starter") compile("org.springframework:spring-web") @@ -90,22 +58,6 @@ dependencies { ) } -jacoco { - toolVersion = "0.8.3" - reportsDir = file("$buildDir/customJacocoReportDir") -} - -jacocoTestReport { - reports { - xml.enabled false - csv.enabled false - html.destination file("${buildDir}/jacocoHtml") - } -} - -task application(type: JavaExec, dependsOn: classes) { - main = 'Cient.Application' -} diff --git a/quality/checkstyle/checkstyle.xml b/quality/checkstyle/checkstyle.xml new file mode 100644 index 0000000..905d05c --- /dev/null +++ b/quality/checkstyle/checkstyle.xml @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/quality/checkstyle/suppression.xml b/quality/checkstyle/suppression.xml new file mode 100644 index 0000000..32fd9c0 --- /dev/null +++ b/quality/checkstyle/suppression.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/Client/build.gradle b/src/Client/build.gradle index 9b01f2b..61f1dea 100644 --- a/src/Client/build.gradle +++ b/src/Client/build.gradle @@ -13,32 +13,27 @@ apply plugin: 'idea' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' apply plugin: 'jacoco' -//apply plugin: 'checkstyle' -// -//checkstyle { -// version = '7.8.1' -// config = 'checkstyle/checkstyle.xml' as File -//} -// -//checkstyleMain { -// source ='src/main/java' -//} -// -//checkstyleTest { -// source ='src/test/java' -//} -// -//tasks.withType(Checkstyle) { -// reports { -// xml.enabled false -// html.enabled true -// html.stylesheet resources.text.fromFile('config/xsl/checkstyle-custom.xsl') -// } -//} +apply plugin: 'checkstyle' sourceCompatibility = 1.8 targetCompatibility = 1.8 +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' +} + test { useJUnitPlatform() } diff --git a/src/Client/src/main/java/greenify/client/Application.java b/src/Client/src/main/java/greenify/client/Application.java index 2ce787e..77ae0c0 100644 --- a/src/Client/src/main/java/greenify/client/Application.java +++ b/src/Client/src/main/java/greenify/client/Application.java @@ -10,6 +10,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ConfigurableApplicationContext; +import java.io.IOException; + @SpringBootApplication public class Application extends javafx.application.Application { private static ConfigurableApplicationContext springContext; @@ -19,16 +21,16 @@ public class Application extends javafx.application.Application { launch(args); } - public static Parent load(java.net.URL url) { + /** + * This method takes an url and return a parent. + * @param url which is being loaded. + * @return parent object. + */ + public static Parent load(java.net.URL url) throws IOException { FXMLLoader loader = new FXMLLoader(); loader.setControllerFactory(springContext::getBean); loader.setLocation(url); - try { - return loader.load(); - } catch (Exception e) { - e.printStackTrace(); - } - return null; + return loader.load(); } @Override diff --git a/src/Client/src/main/java/greenify/client/controller/DashBoardController.java b/src/Client/src/main/java/greenify/client/controller/DashBoardController.java index bfa0576..ff2cde2 100644 --- a/src/Client/src/main/java/greenify/client/controller/DashBoardController.java +++ b/src/Client/src/main/java/greenify/client/controller/DashBoardController.java @@ -6,40 +6,28 @@ import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.AnchorPane; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @Controller public class DashBoardController { + @Autowired + UserService userService; private int count = 0; @FXML - public AnchorPane menuBar; - public AnchorPane dashboardPane; - public AnchorPane userPane; - public AnchorPane activitiesPane; - public Label welcomebacktext; - public Button dashboardButton; - public Button activitiesButton; - public Button userButton; - public Label scoreField; - - //activities buttons - @FXML - public Button veganMealButton; - public Button localProduceButton; - public Button bikeButton; - public Button publicTransportButton; - public Button temperatureButton; - public Button solarPanelButton; - - //activities counters - public Label veganMealCounter; - public Label localProduceCounter; - public Label bikeCounter; - public Label publicTransportCounter; - public Label temperatureCounter; - public Label solarPanelCounter; + private AnchorPane menuBar; + private AnchorPane dashboardPane; + private AnchorPane userPane; + private AnchorPane activitiesPane; + private Label welcomebacktext; + private Button dashboardButton; + private Button activitiesButton; + private Button userButton; + private Button veganMealButton; + private Label counter; + private Label scoreField; /** * displays the dashboard pane. @@ -47,16 +35,9 @@ public class DashBoardController { */ public void displayDashboard(ActionEvent event) { System.out.println("display dashboard"); - - // UserService service = new UserService(); - // UserDTO user = service.getName(null); - // String name = user.getName(); - // welcomebacktext.setText("Welcome back, " + name); - dashboardPane.setVisible(true); userPane.setVisible(false); activitiesPane.setVisible(false); - } /** @@ -87,10 +68,10 @@ public class DashBoardController { */ public void addVeganMeal(ActionEvent event) { count++; - veganMealCounter.setText("Count: " + count); - UserService service = new UserService(); - service.addVeganMeal(null, null); + counter.setText("Count: " + count); + System.out.println(userService); + userService.addVeganMeal(userService.currentUser.getId(), + userService.currentUser.getName()); System.out.println("Vegetarian meal is added"); - } } diff --git a/src/Client/src/main/java/greenify/client/rest/UserService.java b/src/Client/src/main/java/greenify/client/rest/UserService.java index e951973..b0b6490 100644 --- a/src/Client/src/main/java/greenify/client/rest/UserService.java +++ b/src/Client/src/main/java/greenify/client/rest/UserService.java @@ -1,6 +1,6 @@ package greenify.client.rest; -import greenify.common.UserDTO; +import greenify.common.UserDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.annotation.Bean; @@ -17,6 +17,8 @@ public class UserService { @Autowired RestTemplate restTemplate; + public UserDto currentUser; + @Bean RestTemplate restTemplate(RestTemplateBuilder builder) { return builder.build(); @@ -37,7 +39,10 @@ public class UserService { .queryParam("password", password); HttpEntity entity = new HttpEntity<>(headers); System.out.println(builder.build().encode().toUri()); - return this.restTemplate.getForObject(builder.build().encode().toUri(), UserDTO.class); + UserDto result = this.restTemplate.getForObject(builder.build() + .encode().toUri(), UserDto.class); + this.currentUser = result; + return result; } /** @@ -55,7 +60,10 @@ public class UserService { .queryParam("password", password); HttpEntity entity = new HttpEntity<>(headers); System.out.println(builder.build().encode().toUri()); - return this.restTemplate.getForObject(builder.build().encode().toUri(), UserDTO.class); + UserDto result = this.restTemplate.getForObject(builder.build() + .encode().toUri(), UserDto.class); + this.currentUser = result; + return result; } /** @@ -73,7 +81,7 @@ public class UserService { .queryParam("name", name); HttpEntity entity = new HttpEntity<>(headers); System.out.println(builder.build().encode().toUri()); - return this.restTemplate.getForObject(builder.build().encode().toUri(), UserDTO.class); + return this.restTemplate.getForObject(builder.build().encode().toUri(), UserDto.class); } /** diff --git a/src/Client/src/test/java/UserServiceTest.java b/src/Client/src/test/java/UserServiceTest.java index 1c4a7ef..034d840 100644 --- a/src/Client/src/test/java/UserServiceTest.java +++ b/src/Client/src/test/java/UserServiceTest.java @@ -1,9 +1,12 @@ import greenify.client.rest.UserService; -import greenify.common.UserDTO; +import greenify.common.UserDto; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.*; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -22,32 +25,32 @@ public class UserServiceTest { @Test public void userRegisterTest() throws Exception { - UserDTO testUser = new UserDTO(1L, "Eric"); + UserDto testUser = new UserDto(1L, "Eric"); Mockito.when(restTemplate.getForObject(new java.net.URI("http://localhost:8080/registerUser?name=Eric&password=password"), - UserDTO.class)) + UserDto.class)) .thenReturn(testUser); - UserDTO user = userService.registerUser("Eric", "password"); + UserDto user = userService.registerUser("Eric", "password"); Assert.assertEquals(testUser, user); } @Test public void userLoginTest() throws Exception { - UserDTO testUser = new UserDTO(1L, "Eric"); + UserDto testUser = new UserDto(1L, "Eric"); Mockito.when(restTemplate.getForObject(new java.net.URI("http://localhost:8080/loginUser?name=Eric&password=password"), - UserDTO.class)) + UserDto.class)) .thenReturn(testUser); - UserDTO user = userService.loginUser("Eric", "password"); + UserDto user = userService.loginUser("Eric", "password"); Assert.assertEquals(testUser, user); } @Test public void addVeganMealTest() throws Exception { - UserDTO testUser = new UserDTO(1L, "Eric"); + UserDto testUser = new UserDto(1L, "Eric"); Mockito.when(restTemplate.getForObject(new java.net.URI("http://localhost:8080/addVeganMeal?id=1&name=Eric"), - UserDTO.class)) + UserDto.class)) .thenReturn(testUser); - UserDTO user = userService.addVeganMeal(1L, "Eric"); + UserDto user = userService.addVeganMeal(1L, "Eric"); Assert.assertEquals(testUser, user); } } diff --git a/src/Common/build.gradle b/src/Common/build.gradle index a903381..f43cd70 100644 --- a/src/Common/build.gradle +++ b/src/Common/build.gradle @@ -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( diff --git a/src/Common/src/main/java/greenify/common/UserDTO.java b/src/Common/src/main/java/greenify/common/UserDto.java similarity index 87% rename from src/Common/src/main/java/greenify/common/UserDTO.java rename to src/Common/src/main/java/greenify/common/UserDto.java index 8ff9e56..8c67cd2 100644 --- a/src/Common/src/main/java/greenify/common/UserDTO.java +++ b/src/Common/src/main/java/greenify/common/UserDto.java @@ -4,15 +4,14 @@ package greenify.common; // 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 { - +public class UserDto { private Long id; private String name; - public UserDTO() { + public UserDto() { } - public UserDTO(Long id, String name) { + public UserDto(Long id, String name) { this.id = id; this.name = name; } diff --git a/src/Common/src/test/java/ErrorResponseTest.java b/src/Common/src/test/java/ErrorResponseTest.java index d996b40..350e71f 100644 --- a/src/Common/src/test/java/ErrorResponseTest.java +++ b/src/Common/src/test/java/ErrorResponseTest.java @@ -1,9 +1,10 @@ -import greenify.common.ErrorResponse; -import org.junit.Test; - 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() { diff --git a/src/Common/src/test/java/UserDTOTest.java b/src/Common/src/test/java/UserDtoTest.java similarity index 64% rename from src/Common/src/test/java/UserDTOTest.java rename to src/Common/src/test/java/UserDtoTest.java index 33a01f6..1d1d75b 100644 --- a/src/Common/src/test/java/UserDTOTest.java +++ b/src/Common/src/test/java/UserDtoTest.java @@ -1,14 +1,14 @@ -import greenify.common.UserDTO; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -public class UserDTOTest { +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(); + UserDto user = new UserDto(1L, "greenify"); + UserDto testUser = new UserDto(); testUser.setId(1L); testUser.setName("greenify"); assertTrue(user.getId() == 1L); @@ -17,8 +17,8 @@ public class UserDTOTest { @Test public void equalsTest() { - UserDTO first = new UserDTO(1L, "greenify"); - UserDTO second = new UserDTO(1L, "greenify"); + UserDto first = new UserDto(1L, "greenify"); + UserDto second = new UserDto(1L, "greenify"); assertEquals(first.getId(), second.getId()); assertEquals(first.getName(), second.getName()); } diff --git a/src/Server/build.gradle b/src/Server/build.gradle index 4d1b88a..6968ab5 100644 --- a/src/Server/build.gradle +++ b/src/Server/build.gradle @@ -13,6 +13,7 @@ apply plugin: 'idea' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' apply plugin: 'jacoco' +apply plugin: 'checkstyle' bootJar { baseName = 'gs-rest-service' @@ -31,6 +32,22 @@ repositories { sourceCompatibility = 1.8 targetCompatibility = 1.8 +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 { compile("org.springframework.boot:spring-boot-starter-web") testCompile('org.springframework.boot:spring-boot-starter-test') diff --git a/src/Server/src/main/java/greenify/server/data/model/User.java b/src/Server/src/main/java/greenify/server/data/model/User.java index d2b8aa7..8ce92ea 100644 --- a/src/Server/src/main/java/greenify/server/data/model/User.java +++ b/src/Server/src/main/java/greenify/server/data/model/User.java @@ -3,7 +3,11 @@ package greenify.server.data.model; import lombok.Data; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import javax.persistence.*; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; import javax.validation.constraints.NotNull; @EnableAutoConfiguration diff --git a/src/Server/src/main/java/greenify/server/rest/UserController.java b/src/Server/src/main/java/greenify/server/rest/UserController.java index 908efd7..5443de6 100644 --- a/src/Server/src/main/java/greenify/server/rest/UserController.java +++ b/src/Server/src/main/java/greenify/server/rest/UserController.java @@ -1,11 +1,14 @@ package greenify.server.rest; -import greenify.common.UserDTO; +import greenify.common.UserDto; +import greenify.server.data.model.User; +import greenify.server.data.repository.UserRepository; import greenify.server.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; @RestController @@ -14,14 +17,14 @@ public class UserController { UserService userService; @RequestMapping("/registerUser") - public UserDTO registerUser(@RequestParam(value = "name") String name, + public UserDto registerUser(@RequestParam(value = "name") String name, @RequestParam(value = "password") String password) { return userService.registerUser(name, password); } @RequestMapping("/loginUser") - public UserDTO loginUser(@RequestParam(value = "name") String name, - @RequestParam(value = "password") String password) { + public UserDto loginUser(@RequestParam(value = "name") String name, + @RequestParam(value = "password") String password) { return userService.loginUser(name, password); } @@ -34,5 +37,12 @@ public class UserController { @GetMapping("/getUsername") public void getUsername(@RequestParam(value = "id") Long id) { userService.getUsername(id); + + + @GetMapping(path = "/all") + @ResponseBody + public Iterable getAllUsers() { + // This returns a JSON or XML with the users + return userRepository.findAll(); } } \ No newline at end of file diff --git a/src/Server/src/test/java/ApplicationTest.java b/src/Server/src/test/java/ApplicationTest.java index eb54359..4e28ace 100644 --- a/src/Server/src/test/java/ApplicationTest.java +++ b/src/Server/src/test/java/ApplicationTest.java @@ -1,9 +1,6 @@ -import greenify.server.Application; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.SpringBootConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) diff --git a/src/Server/src/test/java/greenify/server/data/model/UserTest.java b/src/Server/src/test/java/greenify/server/data/model/UserTest.java index efe7549..fbc1838 100644 --- a/src/Server/src/test/java/greenify/server/data/model/UserTest.java +++ b/src/Server/src/test/java/greenify/server/data/model/UserTest.java @@ -1,19 +1,19 @@ package greenify.server.data.model; -import greenify.server.data.model.User; -import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.Test; + public class UserTest { @Test public void setAndGetTest() { - User user = new User(1L, "greenify", "password", 3); User testUser = new User(); testUser.setId(1L); testUser.setName("greenify"); testUser.setPassword("password"); testUser.setVeganMeal(3); + User user = new User(1L, "greenify", "password", 3); assertTrue(user.getId().equals(1L)); assertEquals(user.getName(), "greenify"); assertEquals(user.getPassword(), "password"); diff --git a/src/Server/src/test/java/greenify/server/rest/UserControllerTest.java b/src/Server/src/test/java/greenify/server/rest/UserControllerTest.java index abb31d7..a723114 100644 --- a/src/Server/src/test/java/greenify/server/rest/UserControllerTest.java +++ b/src/Server/src/test/java/greenify/server/rest/UserControllerTest.java @@ -1,6 +1,6 @@ //package greenify.server.rest; // -//import greenify.common.UserDTO; +//import greenify.common.UserDto; //import greenify.server.data.model.User; //import greenify.server.service.UserService; //import org.junit.Test; @@ -40,16 +40,18 @@ // @Test // public void getVehicleWhenRequestingTextShouldReturnMakeAndModel() throws Exception { // given(this.userService.loginUser("name", "password")) -// .willReturn(new UserDTO(1L, "name")); +// .willReturn(new UserDto(1L, "name")); // this.mvc.perform(get("/loginUser").accept(MediaType.APPLICATION_JSON)) -// .andExpect(status().isOk()).andExpect(content().json("name=name, password=password")); +// .andExpect(status().isOk()) +// .andExpect(content() +// .json("name=name, password=password")); // } // // // @Test // public void givenEmployees_whenGetEmployees_thenReturnJsonArray() throws Exception { // User alex = new User(1L, "alex", "password", 0); -// UserDTO user = userService.loginUser("alex", "password"); +// UserDto user = userService.loginUser("alex", "password"); // given(userService.loginUser("alex", "password")).willReturn(user); // mvc.perform(get("/loginUser") // .contentType(MediaType.ALL)) diff --git a/src/Server/src/test/java/greenify/server/service/UserServiceTest.java b/src/Server/src/test/java/greenify/server/service/UserServiceTest.java index 467f675..9ef7169 100644 --- a/src/Server/src/test/java/greenify/server/service/UserServiceTest.java +++ b/src/Server/src/test/java/greenify/server/service/UserServiceTest.java @@ -1,7 +1,11 @@ package greenify.server.service; +import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.Mockito.when; + import greenify.common.ApplicationException; -import greenify.common.UserDTO; +import greenify.common.UserDto; import greenify.server.data.model.User; import greenify.server.data.repository.UserRepository; import org.junit.Before; @@ -12,9 +16,6 @@ import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Bean; import org.springframework.test.context.junit4.SpringRunner; -import static org.junit.Assert.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.when; @RunWith(SpringRunner.class) public class UserServiceTest { @@ -32,6 +33,9 @@ public class UserServiceTest { @MockBean private UserRepository userRepository; + /** + * setUp method for test. + */ @Before public void setUp() { User alex = new User(1L, "alex", "password", 0); @@ -43,18 +47,18 @@ public class UserServiceTest { public void validLoginTest() { String name = "alex"; String password = "password"; - UserDTO found = userService.loginUser(name, password); + UserDto found = userService.loginUser(name, password); assertEquals(found.getName(), name); } -// @Test -// public void addVeganMealTest() { -// User user = new User(1L, "x", "y", 3); -// userRepository.save(user); -// System.out.println(userRepository); -// userService.addVeganMeal(1L, "x"); -// assertEquals(user.getVeganMeal(), 7); -// } + // @Test + // public void addVeganMealTest() { + // User user = new User(1L, "x", "y", 3); + // userRepository.save(user); + // System.out.println(userRepository); + // userService.addVeganMeal(1L, "x"); + // assertEquals(user.getVeganMeal(), 7); + // } @Test public void invalidLoginTest() {