minor cleanup
This commit is contained in:
parent
63024cc8e9
commit
bf887e71d9
@ -77,7 +77,7 @@ class PaginatedResultsRetrievedDiscoverabilityListener implements ApplicationLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNextPage(final int page, final int totalPages) {
|
final boolean hasNextPage(final int page, final int totalPages) {
|
||||||
return page < totalPages - 1;
|
return page < (totalPages - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasPreviousPage(final int page) {
|
final boolean hasPreviousPage(final int page) {
|
||||||
@ -89,7 +89,7 @@ class PaginatedResultsRetrievedDiscoverabilityListener implements ApplicationLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasLastPage(final int page, final int totalPages) {
|
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) {
|
final void appendCommaIfNecessary(final StringBuilder linkHeader) {
|
||||||
@ -102,7 +102,7 @@ class PaginatedResultsRetrievedDiscoverabilityListener implements ApplicationLis
|
|||||||
|
|
||||||
protected void plural(final UriComponentsBuilder uriBuilder, final Class clazz) {
|
protected void plural(final UriComponentsBuilder uriBuilder, final Class clazz) {
|
||||||
final String resourceName = clazz.getSimpleName().toLowerCase() + "s";
|
final String resourceName = clazz.getSimpleName().toLowerCase() + "s";
|
||||||
uriBuilder.path("/" + resourceName);
|
uriBuilder.path("/auth/" + resourceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,30 +6,14 @@ import org.baeldung.persistence.model.MyUser;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.test.context.ActiveProfiles;
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.jayway.restassured.RestAssured;
|
import com.jayway.restassured.RestAssured;
|
||||||
import com.jayway.restassured.response.Response;
|
import com.jayway.restassured.response.Response;
|
||||||
import com.jayway.restassured.specification.RequestSpecification;
|
import com.jayway.restassured.specification.RequestSpecification;
|
||||||
|
|
||||||
//@RunWith(SpringJUnit4ClassRunner.class)
|
|
||||||
//@ContextConfiguration(classes = { ConfigTest.class }, loader = AnnotationConfigContextLoader.class)
|
|
||||||
@ActiveProfiles("test")
|
@ActiveProfiles("test")
|
||||||
public class MyUserLiveTest {
|
public class MyUserLiveTest {
|
||||||
|
|
||||||
private final ObjectMapper mapper = new ObjectMapper();
|
|
||||||
private final MyUser userJohn = new MyUser("john", "doe", "john@doe.com", 11);
|
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
|
@Test
|
||||||
public void whenGettingListOfUsers_thenCorrect() {
|
public void whenGettingListOfUsers_thenCorrect() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user