VersioningMapper implements FileOutputMapper { @Override public File mapFile(final File orig) throws VeraPDFException { return version(this.mapper.mapFile(orig)); } private  VersioningMapper(); private  VersioningMapper(final FileOutputMapper mapper); @Override String getPrefix(); @Override String getSuffix(); @Override File mapFile(final File orig);  }
@Test public void testGetVersionSib() throws IOException, VeraPDFException { FileOutputMapper toCompare = FileOutputMappers.sibFiles("", ""); FileOutputMapper toTest = FileOutputMappers.verSibFiles("", ""); File toVersion = new File(tmpRoot.toFile(), origNm); assertTrue(toVersion.createNewFile()); for (int iLoop = 0; iLoop < 20; iLoop++) { File mapped = toTest.mapFile(toVersion); assertTrue(toCompare.mapFile(toVersion).exists()); assertFalse(mapped + " exists.", mapped.exists()); assertTrue(mapped.createNewFile()); } }
@Test public void testGetVersionSibPrf() throws IOException, VeraPDFException { FileOutputMapper toCompare = FileOutputMappers.sibFiles(custPrfx, ""); FileOutputMapper toTest = FileOutputMappers.verSibFiles(custPrfx, ""); File toVersion = new File(tmpRoot.toFile(), origNm); assertTrue(toVersion.createNewFile()); for (int iLoop = 0; iLoop < 20; iLoop++) { File mapped = toTest.mapFile(toVersion); if (iLoop > 0) assertTrue(toCompare.mapFile(toVersion).exists()); assertFalse(mapped + " exists.", mapped.exists()); assertTrue(mapped.createNewFile()); } }
@Test public void testGetVersionSibSfx() throws IOException, VeraPDFException { FileOutputMapper toCompare = FileOutputMappers.sibFiles("", custSfx); FileOutputMapper toTest = FileOutputMappers.verSibFiles("", custSfx); File toVersion = new File(tmpRoot.toFile(), origNm); assertTrue(toVersion.createNewFile()); for (int iLoop = 0; iLoop < 20; iLoop++) { File mapped = toTest.mapFile(toVersion); if (iLoop > 0) assertTrue(toCompare.mapFile(toVersion).exists()); assertFalse(mapped + " exists.", mapped.exists()); assertTrue(mapped.createNewFile()); } }
@Test public void testGetVersionSibExt() throws IOException, VeraPDFException { FileOutputMapper toCompare = FileOutputMappers.sibFiles("", custExt); FileOutputMapper toTest = FileOutputMappers.verSibFiles("", custExt); File toVersion = new File(tmpRoot.toFile(), origNm); assertTrue(toVersion.createNewFile()); for (int iLoop = 0; iLoop < 20; iLoop++) { File mapped = toTest.mapFile(toVersion); if (iLoop > 0) assertTrue(toCompare.mapFile(toVersion).exists()); assertFalse(mapped + " exists.", mapped.exists()); assertTrue(mapped.createNewFile()); } }
@Test public void testGetVersionSibPrfxExt() throws IOException, VeraPDFException { FileOutputMapper toCompare = FileOutputMappers.sibFiles(custPrfx, custExt); FileOutputMapper toTest = FileOutputMappers.verSibFiles(custPrfx, custExt); File toVersion = new File(tmpRoot.toFile(), origNm); assertTrue(toVersion.createNewFile()); for (int iLoop = 0; iLoop < 20; iLoop++) { File mapped = toTest.mapFile(toVersion); if (iLoop > 0) assertTrue(toCompare.mapFile(toVersion).exists()); assertFalse(mapped + " exists.", mapped.exists()); assertTrue(mapped.createNewFile()); } }
@Test public void testGetVersionSub() throws IOException, VeraPDFException { FileOutputMapper toCompare = FileOutputMappers.subFold(custSubFld, "", ""); FileOutputMapper toTest = FileOutputMappers.verSubFold(custSubFld, "", ""); File toVersion = new File(tmpRoot.toFile(), origNm); assertTrue(toVersion.createNewFile()); for (int iLoop = 0; iLoop < 20; iLoop++) { File mapped = toTest.mapFile(toVersion); if (iLoop > 0) assertTrue(toCompare.mapFile(toVersion).exists()); assertFalse(mapped + " exists.", mapped.exists()); assertTrue(mapped.createNewFile()); } }
@Test public void testGetVersionSubPrfx() throws IOException, VeraPDFException { FileOutputMapper toCompare = FileOutputMappers.subFold(custSubFld, custPrfx, ""); FileOutputMapper toTest = FileOutputMappers.verSubFold(custSubFld, custPrfx, ""); File toVersion = new File(tmpRoot.toFile(), origNm); assertTrue(toVersion.createNewFile()); for (int iLoop = 0; iLoop < 20; iLoop++) { File mapped = toTest.mapFile(toVersion); if (iLoop > 0) assertTrue(toCompare.mapFile(toVersion).exists()); assertFalse(mapped + " exists.", mapped.exists()); assertTrue(mapped.createNewFile()); } }
@Test public void testGetVersionSubSfx() throws IOException, VeraPDFException { FileOutputMapper toCompare = FileOutputMappers.subFold(custSubFld, "", custSfx); FileOutputMapper toTest = FileOutputMappers.verSubFold(custSubFld, "", custSfx); File toVersion = new File(tmpRoot.toFile(), origNm); assertTrue(toVersion.createNewFile()); for (int iLoop = 0; iLoop < 20; iLoop++) { File mapped = toTest.mapFile(toVersion); if (iLoop > 0) assertTrue(toCompare.mapFile(toVersion).exists()); assertFalse(mapped + " exists.", mapped.exists()); assertTrue(mapped.createNewFile()); } }
@Test public void testGetVersionExt() throws IOException, VeraPDFException { FileOutputMapper toCompare = FileOutputMappers.subFold(custSubFld, "", custExt); FileOutputMapper toTest = FileOutputMappers.verSubFold(custSubFld, "", custExt); File toVersion = new File(tmpRoot.toFile(), origNm); assertTrue(toVersion.createNewFile()); for (int iLoop = 0; iLoop < 20; iLoop++) { File mapped = toTest.mapFile(toVersion); if (iLoop > 0) assertTrue(toCompare.mapFile(toVersion).exists()); assertFalse(mapped + " exists.", mapped.exists()); assertTrue(mapped.createNewFile()); } }
@Test public void testGetVersionPfxExt() throws IOException, VeraPDFException { FileOutputMapper toCompare = FileOutputMappers.subFold(custSubFld, custPrfx, custExt); FileOutputMapper toTest = FileOutputMappers.verSubFold(custSubFld, custPrfx, custExt); File toVersion = new File(tmpRoot.toFile(), origNm); assertTrue(toVersion.createNewFile()); for (int iLoop = 0; iLoop < 20; iLoop++) { File mapped = toTest.mapFile(toVersion); if (iLoop > 0) assertTrue(toCompare.mapFile(toVersion).exists()); assertFalse(mapped + " exists.", mapped.exists()); assertTrue(mapped.createNewFile()); } }