public NFStatus insertNFStatus(PersistanceActionEnum action) { NFStatus exame = new NFStatus(); Date a = new Date(); exame.setId(1); exame.setModelAction(action); // exame.setNome("Nome"); // exame.setDataNFStatus((int)a.getTime()); // exame.setMedicoResponsavel("Resposnsavel"); // exame.setLaboratorio("Laboratorio"); return exame; }
@Test public void testupdateNFStatus() throws Exception { NFStatus funcionario = new NFStatus(); funcionario = insertNFStatus(PersistanceActionEnum.INSERT); InternalResultsResponse<NFStatus> response = new InternalResultsResponse<NFStatus>(); Integer a = getNFStatusDAC().insertNFStatus(funcionario, "", response); assertEquals(response.getStatus(), Status.OperationSuccess); funcionario = response.getFirstResult(); funcionario.setModelAction(PersistanceActionEnum.UPDATE); funcionario.setId(response.getFirstResult().getId()); response = new InternalResultsResponse<NFStatus>(); a = getNFStatusDAC().updateNFStatus(funcionario, response); assertEquals(response.getStatus(), Status.OperationSuccess); }
@Test public void testdeleteNFStatus() throws Exception { NFStatus funcionario = new NFStatus(); funcionario = insertNFStatus(PersistanceActionEnum.INSERT); InternalResultsResponse<NFStatus> response = new InternalResultsResponse<NFStatus>(); Integer a = getNFStatusDAC().insertNFStatus(funcionario, "", response); assertEquals(response.getStatus(), Status.OperationSuccess); funcionario = response.getFirstResult(); response = new InternalResultsResponse<NFStatus>(); funcionario.setModelAction(PersistanceActionEnum.DELETE); Integer b = getNFStatusDAC().deleteNFStatus(funcionario, response); assertEquals(response.getStatus(), Status.OperationSuccess); FetchByIdRequest request = new FetchByIdRequest(); request.setFetchId(response.getFirstResult().getId()); InternalResultsResponse<NFStatus> responseA = getNFStatusDAC().fetchNFStatusById(request); assertTrue( responseA.getResultsList().get(0).getStatusList().get(0).getStatus() == CdStatusTypeEnum.DELETADO); }