diff --git a/checkstyle.xml b/checkstyle.xml
index 5c45f2c..2219dec 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -1,13 +1,92 @@
+
+ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
+ "https://checkstyle.org/dtds/configuration_1_3.dtd">
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/client/pom.xml b/client/pom.xml
index f9a14e5..45f2677 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -1,130 +1,130 @@
- 4.0.0
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
- csep
- client
- 0.0.1-SNAPSHOT
+ csep
+ client
+ 0.0.1-SNAPSHOT
-
- UTF-8
- 5.10.1
- 5.8.0
- 3.1.9
- 25.0.1
-
+
+ UTF-8
+ 5.10.1
+ 5.8.0
+ 3.1.9
+ 25.0.1
+
-
-
- csep
- commons
- 0.0.1-SNAPSHOT
-
+
+
+ csep
+ commons
+ 0.0.1-SNAPSHOT
+
-
- org.glassfish.jersey.core
- jersey-client
- ${version.jersey}
-
-
- org.glassfish.jersey.inject
- jersey-hk2
- ${version.jersey}
-
-
- org.glassfish.jersey.media
- jersey-media-json-jackson
- ${version.jersey}
-
-
- jakarta.activation
- jakarta.activation-api
- 2.1.3
-
-
- com.google.inject
- guice
- 7.0.0
-
+
+ org.glassfish.jersey.core
+ jersey-client
+ ${version.jersey}
+
+
+ org.glassfish.jersey.inject
+ jersey-hk2
+ ${version.jersey}
+
+
+ org.glassfish.jersey.media
+ jersey-media-json-jackson
+ ${version.jersey}
+
+
+ jakarta.activation
+ jakarta.activation-api
+ 2.1.3
+
+
+ com.google.inject
+ guice
+ 7.0.0
+
-
-
- org.openjfx
- javafx-fxml
- ${version.jfx}
-
-
- org.openjfx
- javafx-controls
- ${version.jfx}
-
-
- org.openjfx
- javafx-web
- ${version.jfx}
-
+
+
+ org.openjfx
+ javafx-fxml
+ ${version.jfx}
+
+
+ org.openjfx
+ javafx-controls
+ ${version.jfx}
+
+
+ org.openjfx
+ javafx-web
+ ${version.jfx}
+
-
-
- org.junit.jupiter
- junit-jupiter-api
- ${version.junit}
- test
-
-
- org.junit.jupiter
- junit-jupiter-engine
- ${version.junit}
- test
-
-
- org.mockito
- mockito-core
- ${version.mockito}
- test
-
-
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ ${version.junit}
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ ${version.junit}
+ test
+
+
+ org.mockito
+ mockito-core
+ ${version.mockito}
+ test
+
+
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.13.0
-
- 23
-
-
-
- org.openjfx
- javafx-maven-plugin
- 0.0.8
-
- client.Main
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
- 3.3.0
-
- ../checkstyle.xml
- ${project.basedir}
- src/**/*.java,**/*.xml,**/*.yml
- **/target/**
-
-
-
- validate
- validate
-
- check
-
-
-
-
-
-
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.13.0
+
+ 23
+
+
+
+ org.openjfx
+ javafx-maven-plugin
+ 0.0.8
+
+ client.Main
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 3.3.0
+
+ ../checkstyle.xml
+ ${project.basedir}
+ src/**/*.java,**/*.xml,**/*.yml
+ **/target/**
+
+
+
+ validate
+ validate
+
+ check
+
+
+
+
+
+
diff --git a/client/src/main/java/client/Main.java b/client/src/main/java/client/Main.java
index 356878d..f7c5a00 100644
--- a/client/src/main/java/client/Main.java
+++ b/client/src/main/java/client/Main.java
@@ -31,27 +31,27 @@ import javafx.stage.Stage;
public class Main extends Application {
- private static final Injector INJECTOR = createInjector(new MyModule());
- private static final MyFXML FXML = new MyFXML(INJECTOR);
+ private static final Injector INJECTOR = createInjector(new MyModule());
+ private static final MyFXML FXML = new MyFXML(INJECTOR);
- public static void main(String[] args) throws URISyntaxException, IOException {
- launch();
- }
+ public static void main(String[] args) throws URISyntaxException, IOException {
+ launch();
+ }
- @Override
- public void start(Stage primaryStage) throws Exception {
+ @Override
+ public void start(Stage primaryStage) throws Exception {
- var serverUtils = INJECTOR.getInstance(ServerUtils.class);
- if (!serverUtils.isServerAvailable()) {
- var msg = "Server needs to be started before the client, but it does not seem to be available. Shutting down.";
- System.err.println(msg);
- return;
- }
+ var serverUtils = INJECTOR.getInstance(ServerUtils.class);
+ if (!serverUtils.isServerAvailable()) {
+ var msg = "Server needs to be started before the client, but it does not seem to be available. Shutting down.";
+ System.err.println(msg);
+ return;
+ }
- var overview = FXML.load(QuoteOverviewCtrl.class, "client", "scenes", "QuoteOverview.fxml");
- var add = FXML.load(AddQuoteCtrl.class, "client", "scenes", "AddQuote.fxml");
+ var overview = FXML.load(QuoteOverviewCtrl.class, "client", "scenes", "QuoteOverview.fxml");
+ var add = FXML.load(AddQuoteCtrl.class, "client", "scenes", "AddQuote.fxml");
- var mainCtrl = INJECTOR.getInstance(MainCtrl.class);
- mainCtrl.initialize(primaryStage, overview, add);
- }
+ var mainCtrl = INJECTOR.getInstance(MainCtrl.class);
+ mainCtrl.initialize(primaryStage, overview, add);
+ }
}
\ No newline at end of file
diff --git a/client/src/main/java/client/scenes/AddQuoteCtrl.java b/client/src/main/java/client/scenes/AddQuoteCtrl.java
index 733ac58..0dcf39f 100644
--- a/client/src/main/java/client/scenes/AddQuoteCtrl.java
+++ b/client/src/main/java/client/scenes/AddQuoteCtrl.java
@@ -83,14 +83,14 @@ public class AddQuoteCtrl {
public void keyPressed(KeyEvent e) {
switch (e.getCode()) {
- case ENTER:
- ok();
- break;
- case ESCAPE:
- cancel();
- break;
- default:
- break;
+ case ENTER:
+ ok();
+ break;
+ case ESCAPE:
+ cancel();
+ break;
+ default:
+ break;
}
}
}
\ No newline at end of file
diff --git a/client/src/main/java/client/utils/ServerUtils.java b/client/src/main/java/client/utils/ServerUtils.java
index d92a0e7..483eed1 100644
--- a/client/src/main/java/client/utils/ServerUtils.java
+++ b/client/src/main/java/client/utils/ServerUtils.java
@@ -35,43 +35,43 @@ import jakarta.ws.rs.core.GenericType;
public class ServerUtils {
- private static final String SERVER = "http://localhost:8080/";
+ private static final String SERVER = "http://localhost:8080/";
- public void getQuotesTheHardWay() throws IOException, URISyntaxException {
- var url = new URI("http://localhost:8080/api/quotes").toURL();
- var is = url.openConnection().getInputStream();
- var br = new BufferedReader(new InputStreamReader(is));
- String line;
- while ((line = br.readLine()) != null) {
- System.out.println(line);
- }
- }
+ public void getQuotesTheHardWay() throws IOException, URISyntaxException {
+ var url = new URI("http://localhost:8080/api/quotes").toURL();
+ var is = url.openConnection().getInputStream();
+ var br = new BufferedReader(new InputStreamReader(is));
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ }
- public List getQuotes() {
- return ClientBuilder.newClient(new ClientConfig()) //
- .target(SERVER).path("api/quotes") //
- .request(APPLICATION_JSON) //
- .get(new GenericType>() {});
- }
+ public List getQuotes() {
+ return ClientBuilder.newClient(new ClientConfig()) //
+ .target(SERVER).path("api/quotes") //
+ .request(APPLICATION_JSON) //
+ .get(new GenericType>() {});
+ }
- public Quote addQuote(Quote quote) {
- return ClientBuilder.newClient(new ClientConfig()) //
- .target(SERVER).path("api/quotes") //
- .request(APPLICATION_JSON) //
- .post(Entity.entity(quote, APPLICATION_JSON), Quote.class);
- }
+ public Quote addQuote(Quote quote) {
+ return ClientBuilder.newClient(new ClientConfig()) //
+ .target(SERVER).path("api/quotes") //
+ .request(APPLICATION_JSON) //
+ .post(Entity.entity(quote, APPLICATION_JSON), Quote.class);
+ }
- public boolean isServerAvailable() {
- try {
- ClientBuilder.newClient(new ClientConfig()) //
- .target(SERVER) //
- .request(APPLICATION_JSON) //
- .get();
- } catch (ProcessingException e) {
- if (e.getCause() instanceof ConnectException) {
- return false;
- }
- }
- return true;
- }
+ public boolean isServerAvailable() {
+ try {
+ ClientBuilder.newClient(new ClientConfig()) //
+ .target(SERVER) //
+ .request(APPLICATION_JSON) //
+ .get();
+ } catch (ProcessingException e) {
+ if (e.getCause() instanceof ConnectException) {
+ return false;
+ }
+ }
+ return true;
+ }
}
\ No newline at end of file
diff --git a/commons/pom.xml b/commons/pom.xml
index 920d5ef..e5d5ff4 100644
--- a/commons/pom.xml
+++ b/commons/pom.xml
@@ -1,102 +1,102 @@
- 4.0.0
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
- csep
- commons
- 0.0.1-SNAPSHOT
+ csep
+ commons
+ 0.0.1-SNAPSHOT
-
- UTF-8
- 5.10.1
- 5.8.0
-
+
+ UTF-8
+ 5.10.1
+ 5.8.0
+
-
-
- org.apache.commons
- commons-lang3
- 3.17.0
-
-
- jakarta.persistence
- jakarta.persistence-api
- 3.1.0
-
+
+
+ org.apache.commons
+ commons-lang3
+ 3.17.0
+
+
+ jakarta.persistence
+ jakarta.persistence-api
+ 3.1.0
+
-
-
- org.junit.jupiter
- junit-jupiter-api
- ${version.junit}
- test
-
-
- org.junit.jupiter
- junit-jupiter-engine
- ${version.junit}
- test
-
-
- org.mockito
- mockito-core
- ${version.mockito}
- test
-
-
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ ${version.junit}
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ ${version.junit}
+ test
+
+
+ org.mockito
+ mockito-core
+ ${version.mockito}
+ test
+
+
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.13.0
-
- 23
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
- 3.3.0
-
- ../checkstyle.xml
- ${project.basedir}
- src/**/*.java,**/*.xml,**/*.yml
- **/target/**
-
-
-
- validate
- validate
-
- check
-
-
-
-
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.13.0
+
+ 23
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 3.3.0
+
+ ../checkstyle.xml
+ ${project.basedir}
+ src/**/*.java,**/*.xml,**/*.yml
+ **/target/**
+
+
+
+ validate
+ validate
+
+ check
+
+
+
+
-
-
- org.springframework.boot
- spring-boot-maven-plugin
- 3.4.0
-
- true
-
-
-
- org.openjfx
- javafx-maven-plugin
- 0.0.8
-
- true
- ignore.Me
-
-
-
-
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ 3.4.0
+
+ true
+
+
+
+ org.openjfx
+ javafx-maven-plugin
+ 0.0.8
+
+ true
+ ignore.Me
+
+
+
+
diff --git a/commons/src/main/java/commons/Person.java b/commons/src/main/java/commons/Person.java
index 299d5d1..f7d2d31 100644
--- a/commons/src/main/java/commons/Person.java
+++ b/commons/src/main/java/commons/Person.java
@@ -29,35 +29,35 @@ import jakarta.persistence.Id;
@Entity
public class Person {
- @Id
- @GeneratedValue(strategy = GenerationType.AUTO)
- public long id;
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ public long id;
- public String firstName;
- public String lastName;
+ public String firstName;
+ public String lastName;
- @SuppressWarnings("unused")
- private Person() {
- // for object mapper
- }
+ @SuppressWarnings("unused")
+ private Person() {
+ // for object mapper
+ }
- public Person(String firstName, String lastName) {
- this.firstName = firstName;
- this.lastName = lastName;
- }
+ public Person(String firstName, String lastName) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ }
- @Override
- public boolean equals(Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
- }
+ @Override
+ public boolean equals(Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this, MULTI_LINE_STYLE);
- }
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, MULTI_LINE_STYLE);
+ }
}
\ No newline at end of file
diff --git a/commons/src/main/java/commons/Quote.java b/commons/src/main/java/commons/Quote.java
index d91f868..60cb27d 100644
--- a/commons/src/main/java/commons/Quote.java
+++ b/commons/src/main/java/commons/Quote.java
@@ -31,36 +31,36 @@ import jakarta.persistence.OneToOne;
@Entity
public class Quote {
- @Id
- @GeneratedValue(strategy = GenerationType.AUTO)
- public long id;
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ public long id;
- @OneToOne(cascade = CascadeType.PERSIST)
- public Person person;
- public String quote;
+ @OneToOne(cascade = CascadeType.PERSIST)
+ public Person person;
+ public String quote;
- @SuppressWarnings("unused")
- private Quote() {
- // for object mappers
- }
+ @SuppressWarnings("unused")
+ private Quote() {
+ // for object mappers
+ }
- public Quote(Person person, String quote) {
- this.person = person;
- this.quote = quote;
- }
+ public Quote(Person person, String quote) {
+ this.person = person;
+ this.quote = quote;
+ }
- @Override
- public boolean equals(Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
- }
+ @Override
+ public boolean equals(Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this, MULTI_LINE_STYLE);
- }
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, MULTI_LINE_STYLE);
+ }
}
\ No newline at end of file
diff --git a/commons/src/test/java/commons/PersonTest.java b/commons/src/test/java/commons/PersonTest.java
index d753178..93c545c 100644
--- a/commons/src/test/java/commons/PersonTest.java
+++ b/commons/src/test/java/commons/PersonTest.java
@@ -23,34 +23,34 @@ import org.junit.jupiter.api.Test;
public class PersonTest {
- @Test
- public void checkConstructor() {
- var p = new Person("f", "l");
- assertEquals("f", p.firstName);
- assertEquals("l", p.lastName);
- }
+ @Test
+ public void checkConstructor() {
+ var p = new Person("f", "l");
+ assertEquals("f", p.firstName);
+ assertEquals("l", p.lastName);
+ }
- @Test
- public void equalsHashCode() {
- var a = new Person("a", "b");
- var b = new Person("a", "b");
- assertEquals(a, b);
- assertEquals(a.hashCode(), b.hashCode());
- }
+ @Test
+ public void equalsHashCode() {
+ var a = new Person("a", "b");
+ var b = new Person("a", "b");
+ assertEquals(a, b);
+ assertEquals(a.hashCode(), b.hashCode());
+ }
- @Test
- public void notEqualsHashCode() {
- var a = new Person("a", "b");
- var b = new Person("a", "c");
- assertNotEquals(a, b);
- assertNotEquals(a.hashCode(), b.hashCode());
- }
+ @Test
+ public void notEqualsHashCode() {
+ var a = new Person("a", "b");
+ var b = new Person("a", "c");
+ assertNotEquals(a, b);
+ assertNotEquals(a.hashCode(), b.hashCode());
+ }
- @Test
- public void hasToString() {
- var actual = new Person("a", "b").toString();
- assertTrue(actual.contains(Person.class.getSimpleName()));
- assertTrue(actual.contains("\n"));
- assertTrue(actual.contains("firstName"));
- }
+ @Test
+ public void hasToString() {
+ var actual = new Person("a", "b").toString();
+ assertTrue(actual.contains(Person.class.getSimpleName()));
+ assertTrue(actual.contains("\n"));
+ assertTrue(actual.contains("firstName"));
+ }
}
\ No newline at end of file
diff --git a/commons/src/test/java/commons/QuoteTest.java b/commons/src/test/java/commons/QuoteTest.java
index bca55f1..85ee201 100644
--- a/commons/src/test/java/commons/QuoteTest.java
+++ b/commons/src/test/java/commons/QuoteTest.java
@@ -23,36 +23,36 @@ import org.junit.jupiter.api.Test;
public class QuoteTest {
- private static final Person SOME_PERSON = new Person("a", "b");
+ private static final Person SOME_PERSON = new Person("a", "b");
- @Test
- public void checkConstructor() {
- var q = new Quote(SOME_PERSON, "q");
- assertEquals(SOME_PERSON, q.person);
- assertEquals("q", q.quote);
- }
+ @Test
+ public void checkConstructor() {
+ var q = new Quote(SOME_PERSON, "q");
+ assertEquals(SOME_PERSON, q.person);
+ assertEquals("q", q.quote);
+ }
- @Test
- public void equalsHashCode() {
- var a = new Quote(new Person("a", "b"), "c");
- var b = new Quote(new Person("a", "b"), "c");
- assertEquals(a, b);
- assertEquals(a.hashCode(), b.hashCode());
- }
+ @Test
+ public void equalsHashCode() {
+ var a = new Quote(new Person("a", "b"), "c");
+ var b = new Quote(new Person("a", "b"), "c");
+ assertEquals(a, b);
+ assertEquals(a.hashCode(), b.hashCode());
+ }
- @Test
- public void notEqualsHashCode() {
- var a = new Quote(new Person("a", "b"), "c");
- var b = new Quote(new Person("a", "b"), "d");
- assertNotEquals(a, b);
- assertNotEquals(a.hashCode(), b.hashCode());
- }
+ @Test
+ public void notEqualsHashCode() {
+ var a = new Quote(new Person("a", "b"), "c");
+ var b = new Quote(new Person("a", "b"), "d");
+ assertNotEquals(a, b);
+ assertNotEquals(a.hashCode(), b.hashCode());
+ }
- @Test
- public void hasToString() {
- var actual = new Quote(new Person("a", "b"), "c").toString();
- assertTrue(actual.contains(Quote.class.getSimpleName()));
- assertTrue(actual.contains("\n"));
- assertTrue(actual.contains("person"));
- }
+ @Test
+ public void hasToString() {
+ var actual = new Quote(new Person("a", "b"), "c").toString();
+ assertTrue(actual.contains(Quote.class.getSimpleName()));
+ assertTrue(actual.contains("\n"));
+ assertTrue(actual.contains("person"));
+ }
}
\ No newline at end of file
diff --git a/server/pom.xml b/server/pom.xml
index 0effa74..e4e9e6a 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -1,76 +1,76 @@
- 4.0.0
-
- org.springframework.boot
- spring-boot-starter-parent
- 3.5.7
-
-
- csep
- server
- 0.0.1-SNAPSHOT
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 3.5.7
+
+
+ csep
+ server
+ 0.0.1-SNAPSHOT
-
- 25
-
+
+ 25
+
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- com.h2database
- h2
- runtime
-
-
- csep
- commons
- 0.0.1-SNAPSHOT
-
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ com.h2database
+ h2
+ runtime
+
+
+ csep
+ commons
+ 0.0.1-SNAPSHOT
+
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
- 3.3.0
-
- ../checkstyle.xml
- ${project.basedir}
- src/**/*.java,**/*.xml,**/*.yml
- **/target/**
-
-
-
- validate
- validate
-
- check
-
-
-
-
-
-
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 3.3.0
+
+ ../checkstyle.xml
+ ${project.basedir}
+ src/**/*.java,**/*.xml,**/*.yml
+ **/target/**
+
+
+
+ validate
+ validate
+
+ check
+
+
+
+
+
+
diff --git a/server/src/main/java/server/api/PersonListingController.java b/server/src/main/java/server/api/PersonListingController.java
index 5f2bf96..ea06a74 100644
--- a/server/src/main/java/server/api/PersonListingController.java
+++ b/server/src/main/java/server/api/PersonListingController.java
@@ -30,23 +30,23 @@ import commons.Person;
@RequestMapping("/api/people")
public class PersonListingController {
- private List people = new LinkedList<>();
+ private List people = new LinkedList<>();
- public PersonListingController() {
- people.add(new Person("Mickey", "Mouse"));
- people.add(new Person("Donald", "Duck"));
- }
+ public PersonListingController() {
+ people.add(new Person("Mickey", "Mouse"));
+ people.add(new Person("Donald", "Duck"));
+ }
- @GetMapping("/")
- public List list() {
- return people;
- }
+ @GetMapping("/")
+ public List list() {
+ return people;
+ }
- @PostMapping("/")
- public List add(@RequestBody Person p) {
- if (!people.contains(p)) {
- people.add(p);
- }
- return people;
- }
+ @PostMapping("/")
+ public List add(@RequestBody Person p) {
+ if (!people.contains(p)) {
+ people.add(p);
+ }
+ return people;
+ }
}
\ No newline at end of file
diff --git a/server/src/test/java/server/api/PersonListingControllerTest.java b/server/src/test/java/server/api/PersonListingControllerTest.java
index 2aee4ab..97b15fe 100644
--- a/server/src/test/java/server/api/PersonListingControllerTest.java
+++ b/server/src/test/java/server/api/PersonListingControllerTest.java
@@ -26,28 +26,28 @@ import commons.Person;
public class PersonListingControllerTest {
- private static final Person MICKEY = new Person("Mickey", "Mouse");
- private static final Person DONALD = new Person("Donald", "Duck");
- private static final Person SCROOGE = new Person("Scrooge", "McDuck");
+ private static final Person MICKEY = new Person("Mickey", "Mouse");
+ private static final Person DONALD = new Person("Donald", "Duck");
+ private static final Person SCROOGE = new Person("Scrooge", "McDuck");
- private PersonListingController sut;
+ private PersonListingController sut;
- @BeforeEach
- public void setup() {
- sut = new PersonListingController();
- }
+ @BeforeEach
+ public void setup() {
+ sut = new PersonListingController();
+ }
- @Test
- public void containsTwoDefaultNames() {
- var actual = sut.list();
- var expected = List.of(MICKEY, DONALD);
- assertEquals(expected, actual);
- }
+ @Test
+ public void containsTwoDefaultNames() {
+ var actual = sut.list();
+ var expected = List.of(MICKEY, DONALD);
+ assertEquals(expected, actual);
+ }
- @Test
- public void canAddPeople() {
- var actual = sut.add(SCROOGE);
- var expected = List.of(MICKEY, DONALD, SCROOGE);
- assertEquals(expected, actual);
- }
+ @Test
+ public void canAddPeople() {
+ var actual = sut.add(SCROOGE);
+ var expected = List.of(MICKEY, DONALD, SCROOGE);
+ assertEquals(expected, actual);
+ }
}
\ No newline at end of file