Search in sources :

Example 1 with UpdateTopApiEntity

use of io.gravitee.management.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.getKey())).thenReturn(singletonList("api"));
    topApiService.update(asList(topApi, topApi2));
}
Also used : UpdateTopApiEntity(io.gravitee.management.model.UpdateTopApiEntity) Test(org.junit.Test)

Example 2 with UpdateTopApiEntity

use of io.gravitee.management.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.getKey())).thenReturn(asList("api", "api2"));
    topApiService.update(asList(topApi, topApi2));
    verify(parameterService).updateMultipleValue(PORTAL_TOP_APIS.getKey(), asList("api2", "api"));
    verify(parameterService).findAll(eq(PORTAL_TOP_APIS.getKey()), any(), any());
}
Also used : UpdateTopApiEntity(io.gravitee.management.model.UpdateTopApiEntity) Test(org.junit.Test)

Aggregations

UpdateTopApiEntity (io.gravitee.management.model.UpdateTopApiEntity)2 Test (org.junit.Test)2