@Test(expected = IllegalArgumentException.class) public void naoDeveDeixarAdicionarUmaProfissaoComOMesmoNome() { Profissao manicure = new Profissao(); manicure.setNome("manicure"); when(profissaoRepo.findByName(manicure.getNome())).thenReturn(manicure); profissaoService.criarNovaProfissao(manicure); }