@Test public void testIsDocumentExtensionPermittedWhenFileNameHasNoExtension() { MultipartFile file = mock(MultipartFile.class); when(file.getOriginalFilename()).thenReturn("hello"); assertFalse(sut.isDocumentExtensionPermitted(file)); }
@Override public boolean isDocumentExtensionPermitted(MultipartFile file) { boolean result = false; int indexOfDot = file.getOriginalFilename().indexOf("."); if (indexOfDot >= 0) { String extension = file.getOriginalFilename().substring( indexOfDot + 1); for (String permittedExtension : permittedExtensionsArray) { if (extension.equals(permittedExtension)) { result = true; break; } } } return result; }
ClinicalDocumentServiceImpl implements ClinicalDocumentService,
		InitializingBean { @Override public boolean isDocumentExtensionPermitted(MultipartFile file) { boolean result = false; int indexOfDot = file.getOriginalFilename().indexOf("."); if (indexOfDot >= 0) { String extension = file.getOriginalFilename().substring( indexOfDot + 1); for (String permittedExtension : permittedExtensionsArray) { if (extension.equals(permittedExtension)) { result = true; break; } } } return result; } }
ClinicalDocumentServiceImpl implements ClinicalDocumentService,
		InitializingBean { @Override public boolean isDocumentExtensionPermitted(MultipartFile file) { boolean result = false; int indexOfDot = file.getOriginalFilename().indexOf("."); if (indexOfDot >= 0) { String extension = file.getOriginalFilename().substring( indexOfDot + 1); for (String permittedExtension : permittedExtensionsArray) { if (extension.equals(permittedExtension)) { result = true; break; } } } return result; } ClinicalDocumentServiceImpl(
			String maxFileSize,
			String permittedExtensions,
			ClinicalDocumentRepository clinicalDocumentRepository,
			ClinicalDocumentTypeCodeRepository clinicalDocumentTypeCodeRepository,
			ModelMapper modelMapper, PatientRepository patientRepository,
			UserContext userContext, Validator validator); }
ClinicalDocumentServiceImpl implements ClinicalDocumentService,
		InitializingBean { @Override public boolean isDocumentExtensionPermitted(MultipartFile file) { boolean result = false; int indexOfDot = file.getOriginalFilename().indexOf("."); if (indexOfDot >= 0) { String extension = file.getOriginalFilename().substring( indexOfDot + 1); for (String permittedExtension : permittedExtensionsArray) { if (extension.equals(permittedExtension)) { result = true; break; } } } return result; } ClinicalDocumentServiceImpl(
			String maxFileSize,
			String permittedExtensions,
			ClinicalDocumentRepository clinicalDocumentRepository,
			ClinicalDocumentTypeCodeRepository clinicalDocumentTypeCodeRepository,
			ModelMapper modelMapper, PatientRepository patientRepository,
			UserContext userContext, Validator validator); @Override void afterPropertiesSet(); @Override long countAllClinicalDocuments(); @Override void deleteClinicalDocument(ClinicalDocumentDto clinicalDocumentDto); @Override ClinicalDocument findClinicalDocument(Long id); @Override List<ClinicalDocument> findAllClinicalDocuments(); @Override List<ClinicalDocument> findClinicalDocumentEntries(int firstResult,
			int maxResults); @Override void saveClinicalDocument(ClinicalDocumentDto clinicalDocumentDto); @Override ClinicalDocument updateClinicalDocument(
			ClinicalDocument clinicalDocument); @Override ClinicalDocumentDto findClinicalDocumentDto(long documentId); @Override List<ClinicalDocument> findByPatient(Patient patient); @Override List<ClinicalDocument> findByPatientId(long patientId); @Override List<ClinicalDocumentDto> findDtoByPatientDto(
			PatientProfileDto patientDto); @Override boolean isDocumentBelongsToThisUser(
			ClinicalDocumentDto clinicalDocumentDto); @Override boolean isDocumentOversized(MultipartFile file); @Override boolean isDocumentExtensionPermitted(MultipartFile file); }
ClinicalDocumentServiceImpl implements ClinicalDocumentService,
		InitializingBean { @Override public boolean isDocumentExtensionPermitted(MultipartFile file) { boolean result = false; int indexOfDot = file.getOriginalFilename().indexOf("."); if (indexOfDot >= 0) { String extension = file.getOriginalFilename().substring( indexOfDot + 1); for (String permittedExtension : permittedExtensionsArray) { if (extension.equals(permittedExtension)) { result = true; break; } } } return result; } ClinicalDocumentServiceImpl(
			String maxFileSize,
			String permittedExtensions,
			ClinicalDocumentRepository clinicalDocumentRepository,
			ClinicalDocumentTypeCodeRepository clinicalDocumentTypeCodeRepository,
			ModelMapper modelMapper, PatientRepository patientRepository,
			UserContext userContext, Validator validator); @Override void afterPropertiesSet(); @Override long countAllClinicalDocuments(); @Override void deleteClinicalDocument(ClinicalDocumentDto clinicalDocumentDto); @Override ClinicalDocument findClinicalDocument(Long id); @Override List<ClinicalDocument> findAllClinicalDocuments(); @Override List<ClinicalDocument> findClinicalDocumentEntries(int firstResult,
			int maxResults); @Override void saveClinicalDocument(ClinicalDocumentDto clinicalDocumentDto); @Override ClinicalDocument updateClinicalDocument(
			ClinicalDocument clinicalDocument); @Override ClinicalDocumentDto findClinicalDocumentDto(long documentId); @Override List<ClinicalDocument> findByPatient(Patient patient); @Override List<ClinicalDocument> findByPatientId(long patientId); @Override List<ClinicalDocumentDto> findDtoByPatientDto(
			PatientProfileDto patientDto); @Override boolean isDocumentBelongsToThisUser(
			ClinicalDocumentDto clinicalDocumentDto); @Override boolean isDocumentOversized(MultipartFile file); @Override boolean isDocumentExtensionPermitted(MultipartFile file);  }