### Question:
ChecksumCalculatingFactory { public Optional<ChecksumCalculatingService> getServiceByChecksum(byte[] checksum, ConsentType consentType) { if (checksum == null) { return getDefaultService(consentType); } String checksumStr = new String(checksum); String[] elements = checksumStr.split(ChecksumConstant.DELIMITER); if (elements.length < 1) { return getDefaultService(consentType); } String versionSting = elements[ChecksumConstant.VERSION_START_POSITION]; return Optional.ofNullable(services.get(new MultiKey(versionSting, consentType))); }  @PostConstruct void init(); Optional<ChecksumCalculatingService> getServiceByChecksum(byte[] checksum, ConsentType consentType);  }### Answer:
@Test void getServiceByChecksum_ais_v3_success() { Optional<ChecksumCalculatingService> actualResult = factory.getServiceByChecksum(CHECKSUM_AIS_V3, AIS_TYPE); assertTrue(actualResult.isPresent()); assertEquals(aisV3.getVersion(), actualResult.get().getVersion()); }
@Test void getServiceByChecksum_ais_noProcessingV001_success() { Optional<ChecksumCalculatingService> actualResult = factory.getServiceByChecksum(getCorrectChecksumV001().getBytes(), AIS_TYPE); assertTrue(actualResult.isPresent()); assertEquals(noProcessingChecksumService.getVersion(), actualResult.get().getVersion()); }
@Test void getServiceByChecksum_ais_noProcessingV002_success() { Optional<ChecksumCalculatingService> actualResult = factory.getServiceByChecksum(getCorrectChecksumV002().getBytes(), AIS_TYPE); assertTrue(actualResult.isPresent()); assertEquals(noProcessingChecksumService.getVersion(), actualResult.get().getVersion()); }
@Test void getServiceByChecksum_ais_v3_null() { Optional<ChecksumCalculatingService> actualResult = factory.getServiceByChecksum(null, null); assertFalse(actualResult.isPresent()); }
@Test void getServiceByChecksum_emptyChecksum() { Optional<ChecksumCalculatingService> actualResult = factory.getServiceByChecksum(new byte[0], AIS_TYPE); assertFalse(actualResult.isPresent()); }
@Test void getServiceByChecksum_wrongChecksum() { Optional<ChecksumCalculatingService> actualResult = factory.getServiceByChecksum(WRONG_CHECKSUM, AIS_TYPE); assertFalse(actualResult.isPresent()); }
@Test void getServiceByChecksum_nullChecksum() { Optional<ChecksumCalculatingService> actualResult = factory.getServiceByChecksum(null, AIS_TYPE); assertTrue(actualResult.isPresent()); assertEquals(aisV3.getVersion(), actualResult.get().getVersion()); }