### Question:
PreWarmParcelParser { public Optional<ClouderaManagerProduct> parseProductFromParcel(List<String> parcel) { Optional<String> url = parcel.stream().filter(parcelPart -> parcelPart.startsWith("http: .findFirst(); Optional<String> nameAndVersion = parcel.stream().filter(parcelPart -> parcelPart.endsWith(".parcel")) .findFirst(); if (url.isEmpty() || nameAndVersion.isEmpty()) { LOGGER.warn("Parcel URL or (name and version) could not be found in the image metadata. " + "Parcel url: '{}', Parcel name and version: '{}'.", url.orElse("null"), nameAndVersion.orElse("null")); return Optional.empty(); } else { ClouderaManagerProduct product = new ClouderaManagerProduct(); String name = substringBefore(nameAndVersion.get(), "-"); LOGGER.info("The parsed product name for parcel is: '{}'.", name); product.setName(name); product.setDisplayName(nameAndVersion.get()); String version = substringAfter(substringBeforeLast(nameAndVersion.get(), "-"), "-"); LOGGER.info("The parsed product version for parcel is: '{}'.", version); product.setVersion(version); LOGGER.info("The URL of the parcel is: '{}'", url.get()); product.setParcel(url.get()); return Optional.of(product); } }  Optional<ClouderaManagerProduct> parseProductFromParcel(List<String> parcel);  }### Answer:
@Test public void testWithValidParcel() { List<String> parcel = List.of(PARCEL_VERSION, PARCEL_URL); Optional<ClouderaManagerProduct> result = preWarmParcelParser.parseProductFromParcel(parcel); assertTrue(result.isPresent()); assertEquals("SCHEMAREGISTRY", result.get().getName()); assertEquals(PARCEL_VERSION, result.get().getDisplayName()); assertEquals(PARCEL_URL, result.get().getParcel()); assertEquals("0.8.0.3.0.0.0-9", result.get().getVersion()); }
@Test public void testWithMissingParcelPart() { List<String> parcel = List.of(PARCEL_VERSION); Optional<ClouderaManagerProduct> result = preWarmParcelParser.parseProductFromParcel(parcel); assertTrue(result.isEmpty()); }