StandardParameters { public static boolean shouldPrettyPrint(EndpointsContext context) { HttpServletRequest request = context.getRequest(); String prettyPrintStr = request.getParameter("prettyPrint"); if (prettyPrintStr == null) { return context.isPrettyPrintEnabled(); } return "true".equals(prettyPrintStr.toLowerCase()); } private  StandardParameters(); static boolean isStandardParamName(String paramName); static boolean shouldPrettyPrint(EndpointsContext context); static final String ALT; static final String FIELDS; static final String KEY; static final String OAUTH_TOKEN; static final String PRETTY_PRINT; static final String QUOTA_USER; static final String USER_IP; static final ImmutableSet<String> STANDARD_PARAM_NAMES; }
@Test public void shouldPrettyPrint_defaultValueIsTrue_globalDefaultTrue() { assertThat(StandardParameters.shouldPrettyPrint( getEndpointsContext(new MockHttpServletRequest(), true))).isTrue(); }
@Test public void shouldPrettyPrint_false_globalDefaultTrue() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setParameter("prettyPrint", "false"); assertThat(StandardParameters.shouldPrettyPrint(getEndpointsContext(request, true))).isFalse(); }
@Test public void shouldPrettyPrint_true_globalDefaultTrue() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setParameter("prettyPrint", "true"); assertThat(StandardParameters.shouldPrettyPrint(getEndpointsContext(request, true))).isTrue(); }
@Test public void shouldPrettyPrint_defaultValueIsFalse_globalDefaultFalse() { assertThat(StandardParameters.shouldPrettyPrint( getEndpointsContext(new MockHttpServletRequest(), false))).isFalse(); }
@Test public void shouldPrettyPrint_false_globalDefaultFalse() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setParameter("prettyPrint", "false"); assertThat(StandardParameters.shouldPrettyPrint(getEndpointsContext(request, false))).isFalse(); }
@Test public void shouldPrettyPrint_true_globalDefaultFalse() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setParameter("prettyPrint", "true"); assertThat(StandardParameters.shouldPrettyPrint(getEndpointsContext(request, false))).isTrue(); }