### Question:
ChecksummedFile { public boolean isValidChecksum( ChecksumAlgorithm algorithm) throws ChecksumValidationException { return isValidChecksum( algorithm, 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 testIsValidChecksum() throws IOException, ChecksumValidationException { Path jarFile = createTestableJar( "examples/redback-authz-open.jar", true, false ); ChecksummedFile checksummedFile = new ChecksummedFile( jarFile ); Assert.assertTrue( "ChecksummedFile.isValid(SHA1)", checksummedFile.isValidChecksum( ChecksumAlgorithm.SHA1 ) ); }
@Test public void testIsValidChecksumInvalidSha1Format() throws IOException, ChecksumValidationException { Path jarFile = createTestableJar( "examples/redback-authz-open.jar" ); Path sha1File = jarFile.resolveSibling( jarFile.getFileName() + ".sha1" ); FileUtils.writeStringToFile( sha1File, FILE_ENCODING, "sha1sum: redback-authz-open.jar: No such file or directory" ); ChecksummedFile checksummedFile = new ChecksummedFile( jarFile ); Assert.assertFalse( "ChecksummedFile.isValid(SHA1)", checksummedFile.isValidChecksum( ChecksumAlgorithm.SHA1 ) ); }