### Question:
HTTPUtilitiesImplementation implements HTTPUtilities { public String valueFromBodyURI(final String tokenName) throws GrinderException { return valueFromBodyURI(tokenName, null); } HTTPUtilitiesImplementation(PluginProcessContext processContext); NVPair basicAuthorizationHeader(String userID, String password); HTTPResponse getLastResponse(); String valueFromLocationURI(final String tokenName); String valueFromBodyInput(final String tokenName); String valueFromBodyInput(String tokenName, String afterText); List<String> valuesFromBodyInput(final String tokenName); List<String> valuesFromBodyInput(String tokenName, String afterText); String valueFromHiddenInput(final String tokenName); String valueFromHiddenInput(String tokenName, String afterText); List<String> valuesFromHiddenInput(final String tokenName); List<String> valuesFromHiddenInput(String tokenName, String afterText); String valueFromBodyURI(final String tokenName); String valueFromBodyURI(final String tokenName, String afterText); List<String> valuesFromBodyURI(final String tokenName); List<String> valuesFromBodyURI(final String tokenName,
                                        String afterText);  }### Answer:
@Test public void testValueFromBodyURI() throws Exception { final HTTPRequest request = new HTTPRequest(); final HTTPUtilities httpUtilities = new HTTPUtilitiesImplementation(m_pluginProcessContext); assertEquals("", httpUtilities.valueFromBodyURI("foo")); final HTTPRequestHandler handler = new HTTPRequestHandler(); handler.start(); request.GET(handler.getURL()); assertEquals("", httpUtilities.valueFromBodyURI("foo")); handler.setBody( "<body><a href='http: request.GET(handler.getURL()); assertEquals("", httpUtilities.valueFromBodyURI("foo")); handler.setBody( "<body><a href='http: request.GET(handler.getURL()); assertEquals("bah", httpUtilities.valueFromBodyURI("foo")); assertEquals("", httpUtilities.valueFromBodyURI("bah")); handler.setBody( "<body><a href='http: request.GET(handler.getURL()); assertEquals("", httpUtilities.valueFromBodyURI("foo")); assertEquals("dah", httpUtilities.valueFromBodyURI("lah")); handler.setBody( "<body><a href='http: "<a href='http: request.GET(handler.getURL()); assertEquals("1234", httpUtilities.valueFromBodyURI("JSESSIONID")); assertEquals("", httpUtilities.valueFromBodyURI("foo")); handler.addHeader("Content-type", "garbage"); request.GET(handler.getURL()); assertEquals("1234", httpUtilities.valueFromBodyURI("JSESSIONID")); assertEquals("", httpUtilities.valueFromBodyURI("foo")); assertEquals("1234", httpUtilities.valueFromBodyURI("JSESSIONID", "<body>")); assertEquals("5678", httpUtilities.valueFromBodyURI("JSESSIONID", "</a>")); assertEquals("", httpUtilities.valueFromBodyURI("JSESSIONID", "5")); assertEquals("", httpUtilities.valueFromBodyURI("JSESSIONID", "999")); handler.shutdown(); }