@Test @Transactional public void getAllFuncionarios() throws Exception { // Initialize the database Funcionario funcionario = funcionarioService.save(funcionarioDTO, ""); funcionarioDTO.setId(funcionario.getId()); // Get all the funcionarios restFuncionarioMockMvc .perform(get("/api/funcionarios")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.[*].id").value(hasItem(funcionarioDTO.getId().intValue()))) .andExpect(jsonPath("$.[*].nome").value(hasItem(DEFAULT_NOME.toString()))) .andExpect(jsonPath("$.[*].cpf").value(hasItem(DEFAULT_CPF.toString()))) .andExpect(jsonPath("$.[*].sexo").value(hasItem(DEFAULT_SEXO.toString()))) .andExpect(jsonPath("$.[*].dataNascimento").value(hasItem(DEFAULT_DATA_NASCIMENTO_STR))) .andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL.toString()))) .andExpect(jsonPath("$.[*].senha").value(hasItem(DEFAULT_SENHA.toString()))) .andExpect(jsonPath("$.[*].ativo").value(hasItem(DEFAULT_ATIVO.booleanValue()))) .andExpect(jsonPath("$.[*].numero").value(hasItem(DEFAULT_NUMERO))) .andExpect(jsonPath("$.[*].complemento").value(hasItem(DEFAULT_COMPLEMENTO.toString()))) .andExpect( jsonPath("$.[*].responsavel").value(hasItem(DEFAULT_RESPONSAVEL.booleanValue()))); }
@Test @Transactional public void deleteFuncionario() throws Exception { // Initialize the database funcionarioService.save(funcionarioDTO, ""); int databaseSizeBeforeDelete = funcionarioRepository.findAll().size(); // Get the funcionarioDTO restFuncionarioMockMvc .perform( delete("/api/funcionarios/{id}", funcionarioDTO.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Funcionario> funcionarios = funcionarioRepository.findAll(); assertThat(funcionarios).hasSize(databaseSizeBeforeDelete - 1); }