Search in sources :

Example 1 with NewGroupEntity

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

the class GroupsResourceTest method shouldCreate.

@Test
public void shouldCreate() {
    reset(groupService);
    NewGroupEntity newGroupEntity = new NewGroupEntity();
    newGroupEntity.setName("my-group-name");
    GroupEntity createdGroup = new GroupEntity();
    createdGroup.setId("my-group-id");
    doReturn(createdGroup).when(groupService).create(any());
    final Response response = envTarget().request().post(Entity.json(newGroupEntity));
    assertEquals(HttpStatusCode.CREATED_201, response.getStatus());
    assertEquals(envTarget().path("my-group-id").getUri().toString(), response.getHeaders().getFirst(HttpHeaders.LOCATION));
}
Also used : Response(javax.ws.rs.core.Response) NewGroupEntity(io.gravitee.rest.api.model.NewGroupEntity) GroupEntity(io.gravitee.rest.api.model.GroupEntity) NewGroupEntity(io.gravitee.rest.api.model.NewGroupEntity) Test(org.junit.Test)

Aggregations

GroupEntity (io.gravitee.rest.api.model.GroupEntity)1 NewGroupEntity (io.gravitee.rest.api.model.NewGroupEntity)1 Response (javax.ws.rs.core.Response)1 Test (org.junit.Test)1