### Question:
AbstractWorkspaceAwareResourceService implements WorkspaceAwareResourceService<T> { @Override public T deleteByNameFromWorkspace(String name, Long workspaceId) { T toBeDeleted = getByNameForWorkspaceId(name, workspaceId); return delete(toBeDeleted); }  @Override T createForLoggedInUser(T resource, @Nonnull Long workspaceId); @Override T create(T resource, @Nonnull Long workspaceId, User user); @Override T createWithMdcContextRestore(T resource, Workspace workspace, User user); @Override T create(T resource, Workspace workspace, User user); @Override T getByNameForWorkspace(String name, Workspace workspace); @Override Set<T> getByNamesForWorkspaceId(Set<String> names, Long workspaceId); @Override T getByNameForWorkspaceId(String name, Long workspaceId); @Override Set<T> findAllByWorkspace(Workspace workspace); @Override Set<T> findAllByWorkspaceId(Long workspaceId); @Override T deleteWithMdcContextRestore(T resource); @Override T delete(T resource); @Override Set<T> delete(Set<T> resources); @Override T deleteByNameFromWorkspace(String name, Long workspaceId); @Override Set<T> deleteMultipleByNameFromWorkspace(Set<String> names, Long workspaceId); @Override Iterable<T> findAll(); @Override T pureSave(T resource); @Override Iterable<T> pureSaveAll(Iterable<T> resources); WorkspaceService getWorkspaceService();  }### Answer:
@Test public void testNotFoundErrorMessage() { when(testRepository.findByNameAndWorkspaceId(anyString(), any())).thenReturn(Optional.empty()); thrown.expect(NotFoundException.class); thrown.expectMessage("No resource found with name 'badname1'"); underTest.deleteByNameFromWorkspace("badname1", 1L); }