DeploymentRealizer implements ConfigurationRealizer<Deployment, DeploymentInfo> { @Override public DeploymentInfo get(Deployment config, InternalCache cache) { Map<String, DeployedJar> deployedJars = getDeployedJars(); DeploymentInfo info = new DeploymentInfo(); String artifactId = JarDeployer.getArtifactId(config.getFileName()); DeployedJar deployedJar = deployedJars.get(artifactId); if (deployedJar != null) { File file = deployedJar.getFile(); info.setLastModified(getDateString(file.lastModified())); info.setJarLocation(file.getAbsolutePath()); } else { info.setJarLocation(JAR_NOT_DEPLOYED); } return info; }  @Override RealizationResult create(Deployment config, InternalCache cache); @Override DeploymentInfo get(Deployment config, InternalCache cache); @Override boolean exists(Deployment config, InternalCache cache); @Override RealizationResult update(Deployment config, InternalCache cache); @Override RealizationResult delete(Deployment config, InternalCache cache);  }
@Test public void getWithJarNotFound() { deployment.setFileName("a.jar"); DeploymentInfo deploymentInfo = realizer.get(deployment, null); assertThat(deploymentInfo.getJarLocation()).isEqualTo(DeploymentRealizer.JAR_NOT_DEPLOYED); }
@Test public void getWithJarFound() { deployment.setFileName("a.jar"); when(deployedJar.getFile()).thenReturn(new File("/test/a.jar")); deployed.put("a", deployedJar); DeploymentInfo deploymentInfo = realizer.get(deployment, null); assertThat(Paths.get(deploymentInfo.getJarLocation()).toUri()) .isEqualTo(Paths.get("/test/a.jar").toUri()); }