.when().delete(GROUP_URL);
}
@Test
public void testUpdateExistingGroup() {
Group initialGroup = MockProvider.createMockGroup();
Group groupUpdate = MockProvider.createMockGroupUpdate();
GroupQuery sampleGroupQuery = mock(GroupQuery.class);
when(identityServiceMock.createGroupQuery()).thenReturn(sampleGroupQuery);
when(sampleGroupQuery.groupId(MockProvider.EXAMPLE_GROUP_ID)).thenReturn(sampleGroupQuery);
when(sampleGroupQuery.singleResult()).thenReturn(initialGroup);
given().pathParam("id", MockProvider.EXAMPLE_GROUP_ID)
.body(GroupDto.fromGroup(groupUpdate)).contentType(ContentType.JSON)
.then().expect().statusCode(Status.NO_CONTENT.getStatusCode())
.when().put(GROUP_URL);
// initial group was updated
verify(initialGroup).setName(groupUpdate.getName());
// and then saved
verify(identityServiceMock).saveGroup(initialGroup);
}