use of io.gravitee.rest.api.model.UpdateTopApiEntity in project gravitee-management-rest-api by gravitee-io.
the class TopApiServiceTest method shouldUpdate.
@Test
public void shouldUpdate() {
final UpdateTopApiEntity topApi = new UpdateTopApiEntity();
topApi.setApi("api");
topApi.setOrder(2);
final UpdateTopApiEntity topApi2 = new UpdateTopApiEntity();
topApi2.setApi("api2");
topApi.setOrder(1);
when(parameterService.findAll(PORTAL_TOP_APIS, ParameterReferenceType.ENVIRONMENT)).thenReturn(asList("api", "api2"));
topApiService.update(asList(topApi, topApi2));
verify(parameterService).save(PORTAL_TOP_APIS, asList("api2", "api"), ParameterReferenceType.ENVIRONMENT);
verify(parameterService).findAll(eq(PORTAL_TOP_APIS), any(Function.class), any(Predicate.class), any(ParameterReferenceType.class));
}
use of io.gravitee.rest.api.model.UpdateTopApiEntity in project gravitee-management-rest-api by gravitee-io.
the class TopApiServiceTest method shouldNotUpdate.
@Test(expected = IllegalArgumentException.class)
public void shouldNotUpdate() {
final UpdateTopApiEntity topApi = new UpdateTopApiEntity();
topApi.setApi("api");
topApi.setOrder(2);
final UpdateTopApiEntity topApi2 = new UpdateTopApiEntity();
topApi2.setApi("api2");
topApi.setOrder(1);
when(parameterService.findAll(PORTAL_TOP_APIS, ParameterReferenceType.ENVIRONMENT)).thenReturn(singletonList("api"));
topApiService.update(asList(topApi, topApi2));
}
Aggregations