@Test public void getAbsolutePathTest() throws IOException { File tempFile = File.createTempFile("testFile", "tmp"); tempFile.deleteOnExit(); String rootPath = tempFile.getParent(); String str1 = DelphiUtils.resolveAbsolutePath(rootPath, tempFile.getName()).getAbsolutePath(); String str2 = DelphiUtils.resolveAbsolutePath(rootPath, "tempDir").getAbsolutePath(); String str3 = DelphiUtils.resolveAbsolutePath(rootPath, rootPath).getAbsolutePath(); assertEquals(rootPath + File.separatorChar + tempFile.getName(), str1); assertEquals(rootPath + File.separatorChar + "tempDir", str2); assertEquals(rootPath, str3); }
@Test public void checkRangeTest() { assertEquals(75.00, DelphiUtils.checkRange(75.00, 75.00, 75.00), 0.0); assertEquals(100.00, DelphiUtils.checkRange(75.00, 100.00, 150.00), 0.0); assertEquals(50.00, DelphiUtils.checkRange(75.00, 00.00, 50.00), 0.0); }