### Question:
Z3950HttpClient implements ExternalCatalogue { @Override public final SearchResultInfo getByField(String targetString, String term, String parameter, String mediaType) throws IOException { Target target = Target.valueOf(targetString.toUpperCase()); String response = null; try ( CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse httpResponse = httpClient.execute(new HttpGet(getURL(target, term, parameter))) ) { if (httpResponse.getStatusLine().getStatusCode() == Response.Status.OK.getStatusCode()) { HttpEntity httpEntity = httpResponse.getEntity(); response = IOUtils.toString(httpEntity.getContent()); EntityUtils.consume(httpEntity); } } return new SearchResultInfo(response != null ? response : ""); } Z3950HttpClient();   Z3950HttpClient(String baseURI, int port);   Z3950HttpClient(String url); final String getBaseURI(); final void setBaseURI(String baseURI); @Override final SearchResultInfo getByField(String targetString, String term, String parameter, String mediaType);  }### Answer:
@Test public void test_it_gets_a_single_MARC_record_by_isbn() throws IOException { z3950ServiceMock.getSingleMarcRecordExpectation(); Z3950HttpClient z3950HttpClient = new Z3950HttpClient("http: SearchResultInfo response = z3950HttpClient.getByField("bibbi", "123123123", "isbn", "Book"); assertTrue(response.getMarcXmlContent().contains("Eksempel Eksempelsen")); }
@Test public void test_it_gets_a_single_MARC_record_by_ean() throws IOException { z3950ServiceMock.getSingleMarcRecordExpectation(); Z3950HttpClient z3950HttpClient = new Z3950HttpClient("http: SearchResultInfo response = z3950HttpClient.getByField("bibbi", "123123123", "ean", "Book"); assertTrue(response.getMarcXmlContent().contains("Eksempel Eksempelsen")); }