From bf887e71d9949c815e6e521d85d4c17c60d03560 Mon Sep 17 00:00:00 2001 From: DOHA Date: Sat, 15 Oct 2016 16:44:51 +0200 Subject: [PATCH] minor cleanup --- ...dResultsRetrievedDiscoverabilityListener.java | 6 +++--- .../java/org/baeldung/web/MyUserLiveTest.java | 16 ---------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/spring-security-rest-full/src/main/java/org/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java b/spring-security-rest-full/src/main/java/org/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java index 312ead0ab0..603c91007d 100644 --- a/spring-security-rest-full/src/main/java/org/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java +++ b/spring-security-rest-full/src/main/java/org/baeldung/web/hateoas/listener/PaginatedResultsRetrievedDiscoverabilityListener.java @@ -77,7 +77,7 @@ class PaginatedResultsRetrievedDiscoverabilityListener implements ApplicationLis } final boolean hasNextPage(final int page, final int totalPages) { - return page < totalPages - 1; + return page < (totalPages - 1); } final boolean hasPreviousPage(final int page) { @@ -89,7 +89,7 @@ class PaginatedResultsRetrievedDiscoverabilityListener implements ApplicationLis } final boolean hasLastPage(final int page, final int totalPages) { - return totalPages > 1 && hasNextPage(page, totalPages); + return (totalPages > 1) && hasNextPage(page, totalPages); } final void appendCommaIfNecessary(final StringBuilder linkHeader) { @@ -102,7 +102,7 @@ class PaginatedResultsRetrievedDiscoverabilityListener implements ApplicationLis protected void plural(final UriComponentsBuilder uriBuilder, final Class clazz) { final String resourceName = clazz.getSimpleName().toLowerCase() + "s"; - uriBuilder.path("/" + resourceName); + uriBuilder.path("/auth/" + resourceName); } } diff --git a/spring-security-rest-full/src/test/java/org/baeldung/web/MyUserLiveTest.java b/spring-security-rest-full/src/test/java/org/baeldung/web/MyUserLiveTest.java index c7fb26d70b..4a3bd50f90 100644 --- a/spring-security-rest-full/src/test/java/org/baeldung/web/MyUserLiveTest.java +++ b/spring-security-rest-full/src/test/java/org/baeldung/web/MyUserLiveTest.java @@ -6,30 +6,14 @@ import org.baeldung.persistence.model.MyUser; import org.junit.Test; import org.springframework.test.context.ActiveProfiles; -import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.restassured.RestAssured; import com.jayway.restassured.response.Response; import com.jayway.restassured.specification.RequestSpecification; -//@RunWith(SpringJUnit4ClassRunner.class) -//@ContextConfiguration(classes = { ConfigTest.class }, loader = AnnotationConfigContextLoader.class) @ActiveProfiles("test") public class MyUserLiveTest { - private final ObjectMapper mapper = new ObjectMapper(); private final MyUser userJohn = new MyUser("john", "doe", "john@doe.com", 11); - private final MyUser userTom = new MyUser("tom", "doe", "tom@doe.com", 20); - - // private static boolean setupDataCreated = false; - // - // @Before - // public void setupData() throws JsonProcessingException { - // if (!setupDataCreated) { - // withRequestBody(givenAuth(), userJohn).post("http://localhost:8080/auth/myusers"); - // withRequestBody(givenAuth(), userTom).post("http://localhost:8080/auth/myusers"); - // setupDataCreated = true; - // } - // } @Test public void whenGettingListOfUsers_thenCorrect() {