@Test public void testVirtualGuestToImageWhenVirtualGuestIsSoftwareLicense() { VirtualGuest virtualGuest = createVirtualGuestWithoutSoftwareLicenseDetails(); Image image = new VirtualGuestToImage(operatingSystemToImage).apply(virtualGuest); assertNotNull(image); assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UNRECOGNIZED); assertEquals(image.getOperatingSystem().getVersion(), "UNRECOGNIZED"); }
@Override public Image apply(VirtualGuest from) { checkNotNull(from, "from"); if (from.getOperatingSystem() == null) { return new ImageBuilder().ids(getReferenceCodeOrId(from)) .name(from.getHostname()) .status(Image.Status.UNRECOGNIZED) .operatingSystem(OperatingSystem.builder() .family(OsFamily.UNRECOGNIZED) .version(UNRECOGNIZED) .description(UNRECOGNIZED) .build()) .build(); } else { return operatingSystemToImage.apply(from.getOperatingSystem()); } }
VirtualGuestToImage implements Function<VirtualGuest, Image> { @Override public Image apply(VirtualGuest from) { checkNotNull(from, "from"); if (from.getOperatingSystem() == null) { return new ImageBuilder().ids(getReferenceCodeOrId(from)) .name(from.getHostname()) .status(Image.Status.UNRECOGNIZED) .operatingSystem(OperatingSystem.builder() .family(OsFamily.UNRECOGNIZED) .version(UNRECOGNIZED) .description(UNRECOGNIZED) .build()) .build(); } else { return operatingSystemToImage.apply(from.getOperatingSystem()); } } }
VirtualGuestToImage implements Function<VirtualGuest, Image> { @Override public Image apply(VirtualGuest from) { checkNotNull(from, "from"); if (from.getOperatingSystem() == null) { return new ImageBuilder().ids(getReferenceCodeOrId(from)) .name(from.getHostname()) .status(Image.Status.UNRECOGNIZED) .operatingSystem(OperatingSystem.builder() .family(OsFamily.UNRECOGNIZED) .version(UNRECOGNIZED) .description(UNRECOGNIZED) .build()) .build(); } else { return operatingSystemToImage.apply(from.getOperatingSystem()); } } @Inject protected  VirtualGuestToImage(OperatingSystemToImage operatingSystemToImage); }
VirtualGuestToImage implements Function<VirtualGuest, Image> { @Override public Image apply(VirtualGuest from) { checkNotNull(from, "from"); if (from.getOperatingSystem() == null) { return new ImageBuilder().ids(getReferenceCodeOrId(from)) .name(from.getHostname()) .status(Image.Status.UNRECOGNIZED) .operatingSystem(OperatingSystem.builder() .family(OsFamily.UNRECOGNIZED) .version(UNRECOGNIZED) .description(UNRECOGNIZED) .build()) .build(); } else { return operatingSystemToImage.apply(from.getOperatingSystem()); } } @Inject protected  VirtualGuestToImage(OperatingSystemToImage operatingSystemToImage); @Override Image apply(VirtualGuest from); String getReferenceCodeOrId(VirtualGuest from); }
VirtualGuestToImage implements Function<VirtualGuest, Image> { @Override public Image apply(VirtualGuest from) { checkNotNull(from, "from"); if (from.getOperatingSystem() == null) { return new ImageBuilder().ids(getReferenceCodeOrId(from)) .name(from.getHostname()) .status(Image.Status.UNRECOGNIZED) .operatingSystem(OperatingSystem.builder() .family(OsFamily.UNRECOGNIZED) .version(UNRECOGNIZED) .description(UNRECOGNIZED) .build()) .build(); } else { return operatingSystemToImage.apply(from.getOperatingSystem()); } } @Inject protected  VirtualGuestToImage(OperatingSystemToImage operatingSystemToImage); @Override Image apply(VirtualGuest from); String getReferenceCodeOrId(VirtualGuest from);  }