### Question:
AbstractExceptionFactory implements ExceptionFactory { @Override public Exception parseException(ResponseCode responseCode, String prefix, String reason, List<String[]> params) { String exceptionPrefix = extractExceptionPrefix(prefix); if (!exceptionInstantiatorMap.containsKey(exceptionPrefix)) { throw new IllegalArgumentException("Unknown exception prefix [" + prefix + "] encountered!"); } return exceptionInstantiatorMap.get(exceptionPrefix).createException(responseCode, prefix, reason, parseExceptionParamList(params)); } AbstractExceptionFactory(); void registerExceptionInstantiator(String exceptionPrefix, ExceptionInstantiator instantiator); @Override Exception parseException(ResponseCode responseCode, String prefix, String reason, List<String[]> params); String extractExceptionPrefix(String prefix);  }### Answer:
@Test public void testParseException() { String exceptionCode = "DSC-0013"; AEF cut = new AEF(); String reason = "too weak"; CougarException ce = (CougarException)cut.parseException(ResponseCode.Forbidden, exceptionCode, reason, null); assertNotNull(ce); assertTrue(ce instanceof CougarClientException); assertEquals(exceptionCode, ce.getServerFaultCode().getDetail()); assertEquals(reason, ce.getMessage()); }
@Test(expected=IllegalArgumentException.class) public void testParseExceptionWithUnknownPrefix() { String exceptionCode = "XXX-0013"; AEF cut = new AEF(); CougarException ce = (CougarException)cut.parseException(ResponseCode.Forbidden, exceptionCode, null, null); }