### Question:
RESTEndpoint extends HTTPEndpoint { @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) { doPost(req, resp); }  @Override void doGet(HttpServletRequest req, HttpServletResponse resp); @Override void doPut(HttpServletRequest req, HttpServletResponse resp); @Override void doPost(HttpServletRequest req, HttpServletResponse resp);  }### Answer:
@Test public void testBadCredentials() throws ConversionException { final RESTEndpoint theEndpoint = new RESTEndpoint(); final HttpServletRequest theRequest = ServletTestRequest.createFromURL("/vl", "/vl/rest/objects/findByName/Private"); final ServletTestResponse theResponse = ServletTestBase.createResponse(); theEndpoint.doGet(theRequest, theResponse); final Map<String, Object> result = ConverterFactory.JSON.convertFrom(theResponse.getWrittenData()); Assert.assertEquals("BadCredential", result.get("title")); Assert.assertEquals("error", result.get("type")); Assert.assertEquals("unauthorized", result.get("message")); Assert.assertEquals(401, result.get("status")); }
@Test public void testEchoGet() { final String theAPIKey = getPublicApplicationAPICaller().getAPIKey();; final RESTEndpoint theEndpoint = new RESTEndpoint(); final ServletTestRequest theRequest = ServletTestRequest.createFromURL("/vl", "/vl/rest/test/echo/\"Hello!\""); theRequest.setRemoteUser(theAPIKey); final ServletTestResponse theResponse = ServletTestBase.createResponse(); theEndpoint.doGet(theRequest, theResponse); Assert.assertEquals("{\"id\":\"Hello!\"}", theResponse.getWrittenData()); }