FIX::fixed package names and imports

changed gogreen to greenify

FIX::made user tostring test succeed

added toString method to user
This commit is contained in:
Sem van der Hoeven
2019-03-12 22:53:43 +01:00
parent d02393400e
commit a265c286eb
19 changed files with 53 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
package gogreen.client; package greenify.client;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Parent; import javafx.scene.Parent;

View File

@@ -1,6 +1,6 @@
package gogreen.client.controller; package greenify.client.controller;
import gogreen.client.rest.UserService; import greenify.client.rest.UserService;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Button; import javafx.scene.control.Button;

View File

@@ -1,6 +1,6 @@
package gogreen.client.controller; package greenify.client.controller;
import gogreen.client.rest.UserService; import greenify.client.rest.UserService;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;

View File

@@ -1,6 +1,6 @@
package gogreen.client.rest; package greenify.client.rest;
import gogreen.common.UserDTO; import greenify.common.UserDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

View File

@@ -1,4 +1,4 @@
import gogreen.client.Application; import greenify.client.Application;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;

View File

@@ -1,5 +1,5 @@
import gogreen.client.rest.UserService; import greenify.client.rest.UserService;
import gogreen.common.UserDTO; import greenify.common.UserDTO;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

View File

@@ -1,4 +1,4 @@
package gogreen.common; package greenify.common;
public class ApplicationException extends RuntimeException { public class ApplicationException extends RuntimeException {
public ApplicationException(String message) { public ApplicationException(String message) {

View File

@@ -1,4 +1,4 @@
package gogreen.common; package greenify.common;
public class ErrorResponse { public class ErrorResponse {
String message; String message;

View File

@@ -1,4 +1,4 @@
package gogreen.common; package greenify.common;
public class UserDTO { public class UserDTO {
private Long id; private Long id;

View File

@@ -1,4 +1,4 @@
package gogreen.server; package greenify.server;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@@ -1,4 +1,4 @@
package gogreen.server.data.model; package greenify.server.data.model;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@@ -55,4 +55,22 @@ public class User {
public String getPassword() { public String getPassword() {
return password; return password;
} }
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "User(id=" + this.id + ", name=" + this.name + ", password=" + this.password + ")";
}
} }

View File

@@ -1,6 +1,6 @@
package gogreen.server.data.repository; package greenify.server.data.repository;
import gogreen.server.data.model.User; import greenify.server.data.model.User;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
public interface UserJpaRepository extends UserRepository, JpaRepository<User,Long> { public interface UserJpaRepository extends UserRepository, JpaRepository<User,Long> {

View File

@@ -1,6 +1,6 @@
package gogreen.server.data.repository; package greenify.server.data.repository;
import gogreen.server.data.model.User; import greenify.server.data.model.User;
public interface UserRepository { public interface UserRepository {
User findByName(String name); User findByName(String name);

View File

@@ -1,7 +1,7 @@
package gogreen.server.rest; package greenify.server.rest;
import gogreen.common.ApplicationException; import greenify.common.ApplicationException;
import gogreen.common.ErrorResponse; import greenify.common.ErrorResponse;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.ResponseStatus;

View File

@@ -1,7 +1,7 @@
package gogreen.server.rest; package greenify.server.rest;
import gogreen.common.UserDTO; import greenify.common.UserDTO;
import gogreen.server.service.UserService; import greenify.server.service.UserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;

View File

@@ -1,9 +1,9 @@
package gogreen.server.service; package greenify.server.service;
import gogreen.common.ApplicationException; import greenify.common.ApplicationException;
import gogreen.common.UserDTO; import greenify.common.UserDTO;
import gogreen.server.data.model.User; import greenify.server.data.model.User;
import gogreen.server.data.repository.UserRepository; import greenify.server.data.repository.UserRepository;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@@ -1,4 +1,4 @@
import gogreen.server.Application; import greenify.server.Application;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;

View File

@@ -1,5 +1,5 @@
import gogreen.common.UserDTO; import greenify.common.UserDTO;
import gogreen.server.Application; import greenify.server.Application;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

View File

@@ -1,4 +1,4 @@
import gogreen.server.data.model.User; import greenify.server.data.model.User;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -7,7 +7,7 @@ public class UserTest {
@Test @Test
public void setAndGetTest() { public void setAndGetTest() {
User user = new User(1L, "greenify", "password"); User user = new User(1L, "greenify", "password");
User testUser = new User(); User testUser = new User(null, null, null);
testUser.setId(1L); testUser.setId(1L);
testUser.setName("greenify"); testUser.setName("greenify");
testUser.setPassword("password"); testUser.setPassword("password");