use of org.everrest.assured.JettyHttpServer.ADMIN_USER_PASSWORD in project che by eclipse.
the class FactoryServiceTest method shouldReturnFactoryListByCreatorAttribute.
@Test
public void shouldReturnFactoryListByCreatorAttribute() throws Exception {
final Factory factory1 = createNamedFactory("factory1");
final Factory factory2 = createNamedFactory("factory2");
when(factoryManager.getByAttribute(2, 0, ImmutableList.of(Pair.of("factory.creator.name", user.getName())))).thenReturn(ImmutableList.of(factory1, factory2));
final Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).contentType(APPLICATION_JSON).when().expect().statusCode(200).get(SERVICE_PATH + "/find?maxItems=2&skipCount=0&factory.creator.name=" + user.getName());
final Set<FactoryDto> res = unwrapDtoList(response, FactoryDto.class).stream().map(f -> f.withLinks(emptyList())).collect(toSet());
assertEquals(res.size(), 2);
assertTrue(res.containsAll(ImmutableList.of(asDto(factory1, user), asDto(factory2, user))));
}
Aggregations