### Question:
DeploymentUnit implements Comparable<DeploymentUnit> { public int compareTo(DeploymentUnit target) { int result = path.compareTo(target.getPath()); if (result == 0) result = (lastModifiedAtTimeOfDeployment > target.lastModified() ? 1 : lastModifiedAtTimeOfDeployment < target.lastModified() ? -1 : 0); return result; } DeploymentUnit(File path); long lastModified(); File getPath(); int compareTo(DeploymentUnit target); boolean equals(Object deploymentUnit); boolean equals(DeploymentUnit deploymentUnit); int hashCode(); String toString();  }### Answer:
@Test public void testCompareTo() throws IOException { File tmp = File.createTempFile("testDeploymentUnit", ".txt"); DeploymentUnit unit1 = new DeploymentUnit(tmp); DeploymentUnit unit2 = new DeploymentUnit(tmp); assertEquals(0, unit1.compareTo(unit2)); tmp.setLastModified(System.currentTimeMillis() + 1000); unit2 = new DeploymentUnit(tmp); assertEquals(-1, unit1.compareTo(unit2)); }