use of io.gravitee.rest.api.model.ApplicationMetadataEntity in project gravitee-management-rest-api by gravitee-io.
the class ApplicationMetadataResourceTest method shouldCreateMetadata.
@Test
public void shouldCreateMetadata() {
Mockito.reset(applicationMetadataService);
NewApplicationMetadataEntity newMetadata = new NewApplicationMetadataEntity();
newMetadata.setName("my-metadata-name");
ApplicationMetadataEntity createdMetadata = new ApplicationMetadataEntity();
createdMetadata.setKey("my-metadata-id");
when(applicationMetadataService.create(any())).thenReturn(createdMetadata);
final Response response = envTarget().path(APPLICATION).path("metadata").request().post(Entity.json(newMetadata));
assertEquals(CREATED_201, response.getStatus());
assertEquals(envTarget().path(APPLICATION).path("metadata").path("my-metadata-id").getUri().toString(), response.getHeaders().getFirst(HttpHeaders.LOCATION));
}
Aggregations