Search in sources :

Example 1 with NewTopApiEntity

use of io.gravitee.rest.api.model.NewTopApiEntity in project gravitee-management-rest-api by gravitee-io.

the class TopApiServiceTest method shouldNotCreate.

@Test(expected = IllegalArgumentException.class)
public void shouldNotCreate() {
    final NewTopApiEntity topApi = new NewTopApiEntity();
    topApi.setApi("api");
    when(parameterService.findAll(PORTAL_TOP_APIS, ParameterReferenceType.ENVIRONMENT)).thenReturn(singletonList("api"));
    topApiService.create(topApi);
}
Also used : NewTopApiEntity(io.gravitee.rest.api.model.NewTopApiEntity) Test(org.junit.Test)

Example 2 with NewTopApiEntity

use of io.gravitee.rest.api.model.NewTopApiEntity in project gravitee-management-rest-api by gravitee-io.

the class TopApiServiceTest method shouldCreate.

@Test
public void shouldCreate() {
    final NewTopApiEntity topApi = new NewTopApiEntity();
    topApi.setApi("api");
    topApiService.create(topApi);
    verify(parameterService).save(PORTAL_TOP_APIS, singletonList("api"), ParameterReferenceType.ENVIRONMENT);
    verify(parameterService).findAll(eq(PORTAL_TOP_APIS), any(Function.class), any(Predicate.class), any(ParameterReferenceType.class));
}
Also used : Function(java.util.function.Function) NewTopApiEntity(io.gravitee.rest.api.model.NewTopApiEntity) ParameterReferenceType(io.gravitee.rest.api.model.parameters.ParameterReferenceType) Predicate(java.util.function.Predicate) Test(org.junit.Test)

Aggregations

NewTopApiEntity (io.gravitee.rest.api.model.NewTopApiEntity)2 Test (org.junit.Test)2 ParameterReferenceType (io.gravitee.rest.api.model.parameters.ParameterReferenceType)1 Function (java.util.function.Function)1 Predicate (java.util.function.Predicate)1