Search in sources :

Example 1 with AvatarAssignment

use of com.faforever.api.data.domain.AvatarAssignment in project faf-java-api by FAForever.

the class AvatarServiceTest method deleteAvatarWithAssignments.

@Test
public void deleteAvatarWithAssignments() throws Exception {
    when(avatarRepository.findById(AVATAR_ID)).thenReturn(Optional.of(new Avatar().setAssignments(Collections.singletonList(new AvatarAssignment()))));
    expectedException.expect(ApiExceptionWithCode.apiExceptionWithCode(ErrorCode.AVATAR_IN_USE));
    avatarService.deleteAvatar(AVATAR_ID);
    verify(avatarRepository, never()).delete(new Avatar());
}
Also used : Avatar(com.faforever.api.data.domain.Avatar) AvatarAssignment(com.faforever.api.data.domain.AvatarAssignment) Test(org.junit.Test)

Aggregations

Avatar (com.faforever.api.data.domain.Avatar)1 AvatarAssignment (com.faforever.api.data.domain.AvatarAssignment)1 Test (org.junit.Test)1