### Question:
OaiPmhRequestFactory { public static OAIRequest createRequest(String baseUrl, String request, boolean ignoreErrors) throws BadArgumentException { Map<OaiParameterName, String> parameters = prepareParameters(request, ignoreErrors); String verb = parameters.get(OaiParameterName.VERB); if (verb == null) { if (ignoreErrors) { return new OAIRequest(null, baseUrl); } throw new BadArgumentException("Verb parameter is missing..."); } if (Identify.class.getSimpleName().equals(verb)) { return createIdentifyRequest(baseUrl); } if (ListIdentifiers.class.getSimpleName().equals(verb)) { return createListIdentifiersRequest(baseUrl, parameters); } if (GetRecord.class.getSimpleName().equals(verb)) { return createGetRecordRequest(baseUrl, parameters.get(OaiParameterName.METADATA_PREFIX), parameters.get(OaiParameterName.IDENTIFIER)); } if (ListSets.class.getSimpleName().equals(verb)) { return createListSetsRequest(baseUrl, parameters); } if (ListMetadataFormats.class.getSimpleName().equals(verb)) { return createListMetadataFormatsRequest(baseUrl, parameters.get(OaiParameterName.IDENTIFIER)); } if (ListRecords.class.getSimpleName().equals(verb)) { return createListRecordsRequest(baseUrl, parameters); } if (!ignoreErrors) { throw new BadArgumentException("Unsupported verb."); } return new OAIRequest(verb, baseUrl); } private  OaiPmhRequestFactory(); static void validateVerb(String verb); static void validateParameterNames(String request); static OAIRequest createRequest(String baseUrl, String request, boolean ignoreErrors); static ListSetsRequest createListSetsRequest(String baseUrl, String resumptionToken); static ListSetsRequest createListSetsRequest(String baseUrl, String from, String until); static ListIdentifiersRequest createListIdentifiersRequest(String baseUrl, String metadataPrefix, String set, String from, String until); static ListIdentifiersRequest createListIdentifiersRequest(String baseUrl, String resumptionToken); static IdentifyRequest createIdentifyRequest(String baseUrl); static GetRecordRequest createGetRecordRequest(String baseUrl, String metadataPrefix, String identifier); static ListMetadataFormatsRequest createListMetadataFormatsRequest(String baseUrl, String identifier); static ListRecordsRequest createListRecordsRequest(String baseUrl, String metadataPrefix, String set, String from, String until); static ListRecordsRequest createListRecordsRequest(String baseUrl, String resumptionToken);  }### Answer:
@Test(expected = BadArgumentException.class) public void validateCreateRequestNoVerb() throws BadArgumentException { OaiPmhRequestFactory.createRequest(BASE_URL, NO_VERB_REQUEST, false); }
@Test(expected = BadArgumentException.class) public void validateCreateRequestUnsupportedVerb() throws BadArgumentException { OaiPmhRequestFactory.createRequest(BASE_URL, UNSUPPORTED_VERB_REQUEST, false); }
@Test public void createRequestWithIdentify() { try { OAIRequest request = OaiPmhRequestFactory.createRequest(BASE_URL, IDENTIFY_REQUEST, false); assertIdentify(request); } catch (BadArgumentException e) { fail(); } }
@Test public void createRequestWithListIdentifiersGeneral() { try { OAIRequest request = OaiPmhRequestFactory.createRequest(BASE_URL, LIST_IDENTIFIERS_GENERAL_REQUEST, false); assertListIdentifiersGeneral(request); } catch (BadArgumentException e) { fail(); } }
@Test public void createRequestWithListIdentifiersResumptionToken() { try { OAIRequest request = OaiPmhRequestFactory.createRequest(BASE_URL, VERB_LIST_IDENTIFIERS_RESUMPTION_TOKEN_REQUEST, false); assertListIdentifiersWithResumptionToken(request); } catch (BadArgumentException e) { fail(); } }