minor cleanup

This commit is contained in:
DOHA 2016-10-15 16:44:51 +02:00
parent 63024cc8e9
commit bf887e71d9
2 changed files with 3 additions and 19 deletions

View File

@ -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);
}
}

View File

@ -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() {