### Question:
PdfVersionCompatibilityChecker { public int getMinimumCompatiblePdfVersion() { switch (signatureDigestAlgorithm) { case PdfSignatureDigestAlgorithms.SHA1: return 0; case PdfSignatureDigestAlgorithms.SHA256: case PdfSignatureDigestAlgorithms.SHA_256: return 6; case PdfSignatureDigestAlgorithms.SHA384: case PdfSignatureDigestAlgorithms.SHA_384: case PdfSignatureDigestAlgorithms.SHA512: case PdfSignatureDigestAlgorithms.SHA_512: case PdfSignatureDigestAlgorithms.RIPEMD160: return 7; default: throw new IllegalArgumentException("Unknown digest algorithm: " + signatureDigestAlgorithm); } } PdfVersionCompatibilityChecker(String pPdfVersionOfDocumentToBeSigned, String pSignatureDigestAlgorithm); int getPdfVersionOfDocumentToBeSigned(); boolean isVersionUpgradeRequired(); int getMinimumCompatiblePdfVersion();  }### Answer:
@Test(expected = IllegalArgumentException.class) public void minimumVersionCannotBeRetrievedForUnknownDigestAlgorithm() { PdfVersionCompatibilityChecker checker = new PdfVersionCompatibilityChecker("0", "HSA 223"); checker.getMinimumCompatiblePdfVersion(); }
@Test public void minimumVersionForSHA1Is0() { PdfVersionCompatibilityChecker checker = new PdfVersionCompatibilityChecker("0", "SHA1"); int minVer = checker.getMinimumCompatiblePdfVersion(); assertEquals(0, minVer); }
@Test public void minimumVersionForSHA256Is6() { PdfVersionCompatibilityChecker checker = new PdfVersionCompatibilityChecker("0", "SHA-256"); int minVer = checker.getMinimumCompatiblePdfVersion(); assertEquals(6, minVer); }
@Test public void minimumVersionForSHA512Is7() { PdfVersionCompatibilityChecker checker = new PdfVersionCompatibilityChecker("0", "SHA512"); int minVer = checker.getMinimumCompatiblePdfVersion(); assertEquals(7, minVer); }