### Question:
LocalChecksumComputerFactoryImpl implements LocalChecksumComputerFactory { @Override public AbstractChecksumComputeStrategy instance(final ChecksumEncodingEnum checksumEncodingEnum) throws ChecksumMethodUnavailableException { if (checksumEncodingEnum == null) { throw new IllegalArgumentException("null checksumEncodingEnum"); } if (checksumEncodingEnum == ChecksumEncodingEnum.MD5) { return new MD5LocalChecksumComputerStrategy(); } else if (checksumEncodingEnum == ChecksumEncodingEnum.SHA256) { return new SHA256LocalChecksumComputerStrategy(); } else { throw new ChecksumMethodUnavailableException( "unable to find a checksum encoding method for:" + checksumEncodingEnum); } }  @Override AbstractChecksumComputeStrategy instance(final ChecksumEncodingEnum checksumEncodingEnum);  }### Answer:
@Test public void testInstanceForMD5() throws Exception { LocalChecksumComputerFactory factory = new LocalChecksumComputerFactoryImpl(); MD5LocalChecksumComputerStrategy actual = (MD5LocalChecksumComputerStrategy) factory .instance(ChecksumEncodingEnum.MD5); Assert.assertNotNull(actual); }
@Test public void testInstanceForSHA256() throws Exception { LocalChecksumComputerFactory factory = new LocalChecksumComputerFactoryImpl(); SHA256LocalChecksumComputerStrategy actual = (SHA256LocalChecksumComputerStrategy) factory .instance(ChecksumEncodingEnum.SHA256); Assert.assertNotNull(actual); }
@Test(expected = ChecksumMethodUnavailableException.class) public void testInstanceForStrong() throws Exception { LocalChecksumComputerFactory factory = new LocalChecksumComputerFactoryImpl(); factory.instance(ChecksumEncodingEnum.STRONG); }
@Test(expected = IllegalArgumentException.class) public void testInstanceForNull() throws Exception { LocalChecksumComputerFactory factory = new LocalChecksumComputerFactoryImpl(); factory.instance(null); }