- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {Charset c =
String charsetName;Charset.forName(charsetName)
Charset.defaultCharset()
ContentType contentType;contentType.getCharset()
- Smart code suggestions by Codota
}
@Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("application/json"); PrintWriter out = resp.getWriter(); boolean proxyModeOn = proxyModeToggle.isProxyModeOn(); boolean stubModeOn = routingService.isStubModeOn(); boolean wilmaModeOn = !proxyModeOn && !stubModeOn; out.write("{\"proxyMode\":" + proxyModeOn + ",\"stubMode\":" + stubModeOn + ",\"wilmaMode\":" + wilmaModeOn + "}"); out.flush(); out.close(); }
@Test public void testDoGetShouldWriteStatusToResponse() throws ServletException, IOException { //GIVEN given(proxyModeToggle.isProxyModeOn()).willReturn(true); given(routingService.isStubModeOn()).willReturn(false); //WHEN underTest.doGet(request, response); //THEN verify(printWriter).write("{\"proxyMode\":true,\"stubMode\":false,\"wilmaMode\":false}"); }
@Test public void testDoGetShouldWriteSetContentTypeToJson() throws ServletException, IOException { //GIVEN given(proxyModeToggle.isProxyModeOn()).willReturn(true); given(routingService.isStubModeOn()).willReturn(false); //WHEN underTest.doGet(request, response); //THEN verify(response).setContentType("application/json"); }
@Test public void testDoPostShouldWriteStatusToResponse() throws ServletException, IOException { //GIVEN given(proxyModeToggle.isProxyModeOn()).willReturn(true); given(routingService.isStubModeOn()).willReturn(false); //WHEN underTest.doPost(request, response); //THEN verify(printWriter).write("{\"proxyMode\":true,\"stubMode\":false,\"wilmaMode\":false}"); } }