Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Oct 11, 2023
1 parent 02d2749 commit 6e740c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public void testExists() {
public void testCreateFile() {
final String temp = StringUtils.removeEnd(System.getProperty("java.io.tmpdir"), File.separator);
final String s = System.getProperty("file.separator");
assertEquals(String.format("%s%su%sp%s887503681%sf", temp, s, s, s, s),
assertEquals(String.format("%s%su%sp%s1742810335%sf", temp, s, s, s, s),
new DefaultTemporaryFileService().create("u", new Path("/p/f", EnumSet.of(Path.Type.file))).getAbsolute());
final Path file = new Path("/p/f", EnumSet.of(Path.Type.file));
file.attributes().setRegion("region");
assertEquals(String.format("%s%su%sp%s887503681%sf", temp, s, s, s, s),
assertEquals(String.format("%s%su%sp%s1742810335%sf", temp, s, s, s, s),
new DefaultTemporaryFileService().create("u", file).getAbsolute());
}

Expand All @@ -53,14 +53,14 @@ public void testVersion() {
final Path file = new Path("/p/f", EnumSet.of(Path.Type.file));
file.attributes().setRegion("region");
file.attributes().setVersionId("2");
assertEquals(String.format("%s%su%sp%s887551731%sf", temp, s, s, s, s),
assertEquals(String.format("%s%su%sp%s1744299885%sf", temp, s, s, s, s),
new DefaultTemporaryFileService().create("u", file).getAbsolute());
}
{
final Path file = new Path("/p", EnumSet.of(Path.Type.directory));
file.attributes().setRegion("region");
file.attributes().setVersionId("2");
assertEquals(String.format("%s%su%s887551731%sp", temp, s, s, s),
assertEquals(String.format("%s%su%s1744299885%sp", temp, s, s, s),
new DefaultTemporaryFileService().create("u", file).getAbsolute());
}
}
Expand All @@ -71,7 +71,7 @@ public void testCreateContainer() {
final String s = System.getProperty("file.separator");
final Path file = new Path("/container", EnumSet.of(Path.Type.directory));
file.attributes().setRegion("region");
assertEquals(String.format("%s%su%s887503681%scontainer", temp, s, s, s),
assertEquals(String.format("%s%su%s1742810335%scontainer", temp, s, s, s),
new DefaultTemporaryFileService().create("u", file).getAbsolute());
}

Expand All @@ -87,8 +87,8 @@ public void testPathTooLong() {
file.attributes().setVersionId("2");
final Local local = new DefaultTemporaryFileService().create("UID", file);
final String localFile = local.getAbsolute();
assertNotEquals(String.format("%s/%s%s/887551731/%s", temp, "UID", testPathDirectory, testPathFile).replace('/', File.separatorChar), localFile);
assertEquals(String.format("%s/%s/%s/887551731/%s", temp, "UID", testPathMD5, testPathFile).replace('/', File.separatorChar), localFile);
assertNotEquals(String.format("%s/%s%s/1744299885/%s", temp, "UID", testPathDirectory, testPathFile).replace('/', File.separatorChar), localFile);
assertEquals(String.format("%s/%s/%s/1744299885/%s", temp, "UID", testPathMD5, testPathFile).replace('/', File.separatorChar), localFile);
}

@Test
Expand All @@ -103,8 +103,8 @@ public void testPathNotTooLong() {
file.attributes().setVersionId("2");
final Local local = new DefaultTemporaryFileService().create("UID", file);
final String localFile = local.getAbsolute();
assertEquals(String.format("%s/%s%s/887551731/%s", temp, "UID", testPathDirectory, testPathFile).replace('/', File.separatorChar), localFile);
assertNotEquals(String.format("%s/%s%s/887551731/%s", temp, "UID", testPathMD5, testPathFile).replace('/', File.separatorChar), localFile);
assertEquals(String.format("%s/%s%s/1744299885/%s", temp, "UID", testPathDirectory, testPathFile).replace('/', File.separatorChar), localFile);
assertNotEquals(String.format("%s/%s%s/1744299885/%s", temp, "UID", testPathMD5, testPathFile).replace('/', File.separatorChar), localFile);
}

@Test
Expand All @@ -115,7 +115,7 @@ public void testTemporaryPath() {
final Local local = new DefaultTemporaryFileService().create(file);
assertEquals("t.txt", file.getName());
assertEquals("t.txt", local.getName());
assertEquals("887550770", local.getParent().getName());
assertEquals("1744270094", local.getParent().getName());
assertEquals("f2", local.getParent().getParent().getName());
assertEquals("f1", local.getParent().getParent().getParent().getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public void testExists() {
public void testCreateFile() {
final String temp = StringUtils.removeEnd(System.getProperty("java.io.tmpdir"), File.separator);
final String s = System.getProperty("file.separator");
assertEquals(String.format("%s%su%s887503681-f", temp, s, s),
assertEquals(String.format("%s%su%s1742810335-f", temp, s, s),
new FlatTemporaryFileService().create("u", new Path("/p/f", EnumSet.of(Path.Type.file))).getAbsolute());
final Path file = new Path("/p/f", EnumSet.of(Path.Type.file));
file.attributes().setRegion("region");
assertEquals(String.format("%s%su%s887503681-f", temp, s, s),
assertEquals(String.format("%s%su%s1742810335-f", temp, s, s),
new FlatTemporaryFileService().create("u", file).getAbsolute());
}

Expand All @@ -67,7 +67,7 @@ public void testCreateContainer() {
final String s = System.getProperty("file.separator");
final Path file = new Path("/container", EnumSet.of(Path.Type.directory));
file.attributes().setRegion("region");
assertEquals(String.format("%s%su%s887503681-container", temp, s, s),
assertEquals(String.format("%s%su%s1742810335-container", temp, s, s),
new FlatTemporaryFileService().create("u", file).getAbsolute());
}

Expand Down Expand Up @@ -99,8 +99,8 @@ public void testPathNotTooLong() {
final Local local = new FlatTemporaryFileService().create("UID", file);
assertTrue(local.getParent().exists());
final String localFile = local.getAbsolute();
assertEquals(String.format("%s/%s/887551731-%s", temp, "UID", testPathFile).replace('/', File.separatorChar), localFile);
assertNotEquals(String.format("%s/%s%s/2/887551731-%s", temp, "UID", testPathMD5, testPathFile).replace('/', File.separatorChar), localFile);
assertEquals(String.format("%s/%s/1744299885-%s", temp, "UID", testPathFile).replace('/', File.separatorChar), localFile);
assertNotEquals(String.format("%s/%s%s/2/1744299885-%s", temp, "UID", testPathMD5, testPathFile).replace('/', File.separatorChar), localFile);
}

@Test
Expand Down

0 comments on commit 6e740c2

Please sign in to comment.