@Test public void testFindRevType_when_modifiedEntity_size_is_two_Second() { List<ModifiedEntityTypeEntity> modifiedEntityTypeEntitys = new ArrayList<ModifiedEntityTypeEntity>(); modifiedEntityTypeEntitys.add(mock(ModifiedEntityTypeEntity.class)); modifiedEntityTypeEntitys.add(mock(ModifiedEntityTypeEntity.class)); when(modifiedEntityTypeEntitys.get(0).getRevisionType()).thenReturn( (byte) 2); AuditService pasutSpy = spy(pasut); pasutSpy.findRevType(modifiedEntityTypeEntitys); verify(pasutSpy, times(1)).findRevType((byte) 2); }
@Override public String findRevType( List<ModifiedEntityTypeEntity> modifiedEntityTypeEntitys) { Byte btype = 1; if (modifiedEntityTypeEntitys.size() == 1) btype = modifiedEntityTypeEntitys.get(0).getRevisionType(); if (modifiedEntityTypeEntitys.size() == 2) { if (modifiedEntityTypeEntitys.get(0).getRevisionType() != 1) btype = modifiedEntityTypeEntitys.get(0).getRevisionType(); else btype = modifiedEntityTypeEntitys.get(1).getRevisionType(); } if (modifiedEntityTypeEntitys.size() == 3) { if (modifiedEntityTypeEntitys.get(0).getRevisionType() == 2 || modifiedEntityTypeEntitys.get(1).getRevisionType() == 2 || modifiedEntityTypeEntitys.get(2).getRevisionType() == 2) btype = 2; else if (modifiedEntityTypeEntitys.get(0).getRevisionType() == 0 || modifiedEntityTypeEntitys.get(1).getRevisionType() == 0 || modifiedEntityTypeEntitys.get(2).getRevisionType() == 0) btype = 0; } String revType = findRevType(btype); return revType; }
AuditServiceImpl implements AuditService { @Override public String findRevType( List<ModifiedEntityTypeEntity> modifiedEntityTypeEntitys) { Byte btype = 1; if (modifiedEntityTypeEntitys.size() == 1) btype = modifiedEntityTypeEntitys.get(0).getRevisionType(); if (modifiedEntityTypeEntitys.size() == 2) { if (modifiedEntityTypeEntitys.get(0).getRevisionType() != 1) btype = modifiedEntityTypeEntitys.get(0).getRevisionType(); else btype = modifiedEntityTypeEntitys.get(1).getRevisionType(); } if (modifiedEntityTypeEntitys.size() == 3) { if (modifiedEntityTypeEntitys.get(0).getRevisionType() == 2 || modifiedEntityTypeEntitys.get(1).getRevisionType() == 2 || modifiedEntityTypeEntitys.get(2).getRevisionType() == 2) btype = 2; else if (modifiedEntityTypeEntitys.get(0).getRevisionType() == 0 || modifiedEntityTypeEntitys.get(1).getRevisionType() == 0 || modifiedEntityTypeEntitys.get(2).getRevisionType() == 0) btype = 0; } String revType = findRevType(btype); return revType; } }
AuditServiceImpl implements AuditService { @Override public String findRevType( List<ModifiedEntityTypeEntity> modifiedEntityTypeEntitys) { Byte btype = 1; if (modifiedEntityTypeEntitys.size() == 1) btype = modifiedEntityTypeEntitys.get(0).getRevisionType(); if (modifiedEntityTypeEntitys.size() == 2) { if (modifiedEntityTypeEntitys.get(0).getRevisionType() != 1) btype = modifiedEntityTypeEntitys.get(0).getRevisionType(); else btype = modifiedEntityTypeEntitys.get(1).getRevisionType(); } if (modifiedEntityTypeEntitys.size() == 3) { if (modifiedEntityTypeEntitys.get(0).getRevisionType() == 2 || modifiedEntityTypeEntitys.get(1).getRevisionType() == 2 || modifiedEntityTypeEntitys.get(2).getRevisionType() == 2) btype = 2; else if (modifiedEntityTypeEntitys.get(0).getRevisionType() == 0 || modifiedEntityTypeEntitys.get(1).getRevisionType() == 0 || modifiedEntityTypeEntitys.get(2).getRevisionType() == 0) btype = 0; } String revType = findRevType(btype); return revType; } AuditServiceImpl(
			EntityManagerFactory entityManagerFactory,
			PatientRepository patientRepository,
			RevisionInfoEntityRepository patientRevisionEntityRepository,
			ModifiedEntityTypeEntityRepository modifiedEntityTypeEntityRepository,
			PatientLegalRepresentativeAssociationRepository patientLegalRepresentativeAssociationRepository,
			StaffRepository staffRepository); }
AuditServiceImpl implements AuditService { @Override public String findRevType( List<ModifiedEntityTypeEntity> modifiedEntityTypeEntitys) { Byte btype = 1; if (modifiedEntityTypeEntitys.size() == 1) btype = modifiedEntityTypeEntitys.get(0).getRevisionType(); if (modifiedEntityTypeEntitys.size() == 2) { if (modifiedEntityTypeEntitys.get(0).getRevisionType() != 1) btype = modifiedEntityTypeEntitys.get(0).getRevisionType(); else btype = modifiedEntityTypeEntitys.get(1).getRevisionType(); } if (modifiedEntityTypeEntitys.size() == 3) { if (modifiedEntityTypeEntitys.get(0).getRevisionType() == 2 || modifiedEntityTypeEntitys.get(1).getRevisionType() == 2 || modifiedEntityTypeEntitys.get(2).getRevisionType() == 2) btype = 2; else if (modifiedEntityTypeEntitys.get(0).getRevisionType() == 0 || modifiedEntityTypeEntitys.get(1).getRevisionType() == 0 || modifiedEntityTypeEntitys.get(2).getRevisionType() == 0) btype = 0; } String revType = findRevType(btype); return revType; } AuditServiceImpl(
			EntityManagerFactory entityManagerFactory,
			PatientRepository patientRepository,
			RevisionInfoEntityRepository patientRevisionEntityRepository,
			ModifiedEntityTypeEntityRepository modifiedEntityTypeEntityRepository,
			PatientLegalRepresentativeAssociationRepository patientLegalRepresentativeAssociationRepository,
			StaffRepository staffRepository); @Override List<HistoryDto> findAllHistory(String username); @Override List<HistoryDto> getReversed(List<HistoryDto> original); @Override List<HistoryDto> findHistoryDetails(List<Number> revisions); @Override List<HistoryDto> makeHistoryDtos(); @Override HistoryDto makeHistoryDto(); @Override HistoryDto findHistoryDetail(Number n); List<HistoryDto> findConsentRevokationHistoryByPatient(
			AuditReader reader, long patientId); List<HistoryDto> findConsentSignPDFHistoryByPatient(
			AuditReader reader, long patientId); @Override String findRevType(
			List<ModifiedEntityTypeEntity> modifiedEntityTypeEntitys); @Override String findRevType(Byte btype); @Override String findRevClassName(
			List<ModifiedEntityTypeEntity> modifiedEntityTypeEntitys); @Override List<HistoryDto> findLegalHistoryByPatient(long patientId); @Override List<HistoryDto> findLegalHistoryDetails(List<Number> revisions); @Override HistoryDto findLegalHistoryDetail(Number n); }
AuditServiceImpl implements AuditService { @Override public String findRevType( List<ModifiedEntityTypeEntity> modifiedEntityTypeEntitys) { Byte btype = 1; if (modifiedEntityTypeEntitys.size() == 1) btype = modifiedEntityTypeEntitys.get(0).getRevisionType(); if (modifiedEntityTypeEntitys.size() == 2) { if (modifiedEntityTypeEntitys.get(0).getRevisionType() != 1) btype = modifiedEntityTypeEntitys.get(0).getRevisionType(); else btype = modifiedEntityTypeEntitys.get(1).getRevisionType(); } if (modifiedEntityTypeEntitys.size() == 3) { if (modifiedEntityTypeEntitys.get(0).getRevisionType() == 2 || modifiedEntityTypeEntitys.get(1).getRevisionType() == 2 || modifiedEntityTypeEntitys.get(2).getRevisionType() == 2) btype = 2; else if (modifiedEntityTypeEntitys.get(0).getRevisionType() == 0 || modifiedEntityTypeEntitys.get(1).getRevisionType() == 0 || modifiedEntityTypeEntitys.get(2).getRevisionType() == 0) btype = 0; } String revType = findRevType(btype); return revType; } AuditServiceImpl(
			EntityManagerFactory entityManagerFactory,
			PatientRepository patientRepository,
			RevisionInfoEntityRepository patientRevisionEntityRepository,
			ModifiedEntityTypeEntityRepository modifiedEntityTypeEntityRepository,
			PatientLegalRepresentativeAssociationRepository patientLegalRepresentativeAssociationRepository,
			StaffRepository staffRepository); @Override List<HistoryDto> findAllHistory(String username); @Override List<HistoryDto> getReversed(List<HistoryDto> original); @Override List<HistoryDto> findHistoryDetails(List<Number> revisions); @Override List<HistoryDto> makeHistoryDtos(); @Override HistoryDto makeHistoryDto(); @Override HistoryDto findHistoryDetail(Number n); List<HistoryDto> findConsentRevokationHistoryByPatient(
			AuditReader reader, long patientId); List<HistoryDto> findConsentSignPDFHistoryByPatient(
			AuditReader reader, long patientId); @Override String findRevType(
			List<ModifiedEntityTypeEntity> modifiedEntityTypeEntitys); @Override String findRevType(Byte btype); @Override String findRevClassName(
			List<ModifiedEntityTypeEntity> modifiedEntityTypeEntitys); @Override List<HistoryDto> findLegalHistoryByPatient(long patientId); @Override List<HistoryDto> findLegalHistoryDetails(List<Number> revisions); @Override HistoryDto findLegalHistoryDetail(Number n);  }