### Question:
ChecksummedFile { public boolean isValidChecksums( List<ChecksumAlgorithm> algorithms) throws ChecksumValidationException { return isValidChecksums( algorithms, false ); } ChecksummedFile( final Path referenceFile ); static ChecksumReference getFromChecksumFile( Path checksumFile ); String calculateChecksum( ChecksumAlgorithm checksumAlgorithm ); Path writeFile(ChecksumAlgorithm checksumAlgorithm ); Path getChecksumFile( ChecksumAlgorithm checksumAlgorithm ); boolean isValidChecksum( ChecksumAlgorithm algorithm); boolean isValidChecksum( ChecksumAlgorithm algorithm, boolean throwExceptions ); boolean isValidChecksums( List<ChecksumAlgorithm> algorithms); boolean isValidChecksums( List<ChecksumAlgorithm> algorithms, boolean throwExceptions); Path getReferenceFile( ); UpdateStatusList fixChecksum(ChecksumAlgorithm algorithm); UpdateStatusList fixChecksums( List<ChecksumAlgorithm> algorithms ); String parseChecksum( Path checksumFile, ChecksumAlgorithm checksumAlgorithm, String fileName, Charset encoding ); ChecksumFileContent parseChecksumFile( Path checksumFile, ChecksumAlgorithm checksumAlgorithm, Charset encoding );  }### Answer:
@Test public void testIsValidChecksumNoChecksumFiles() throws IOException, ChecksumValidationException { Path jarFile = createTestableJar( "examples/redback-authz-open.jar", false, false ); ChecksummedFile checksummedFile = new ChecksummedFile( jarFile ); Assert.assertFalse( "ChecksummedFile.isValid(SHA1,MD5)", checksummedFile.isValidChecksums( Arrays.asList(ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 ) ) ); }
@Test public void testIsValidChecksumSha1AndMd5() throws IOException, ChecksumValidationException { Path jarFile = createTestableJar( "examples/redback-authz-open.jar", true, true ); ChecksummedFile checksummedFile = new ChecksummedFile( jarFile ); Assert.assertTrue( "ChecksummedFile.isValid(SHA1,MD5)", checksummedFile.isValidChecksums( Arrays.asList(ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 ) ) ); }
@Test public void testIsValidChecksumSha1NoMd5() throws IOException, ChecksumValidationException { Path jarFile = createTestableJar( "examples/redback-authz-open.jar", true, false ); ChecksummedFile checksummedFile = new ChecksummedFile( jarFile ); Assert.assertTrue( "ChecksummedFile.isValid(SHA1)", checksummedFile.isValidChecksums( Arrays.asList(ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 ) ) ); }