@Test
public void testValidatePeerAuthenticator_privateNullary() throws Exception {

  final class InvalidPeerAuthenticator implements PeerAuthenticator {
  @SuppressWarnings("unused")
    private InvalidPeerAuthenticator() {}
  @SuppressWarnings("unused")
  @Override
    public boolean authenticate(HttpServletRequest request) {
      return false;
    }
  }
  config.getApiClassConfig().getMethods()
      .get(methodToEndpointMethod(TestEndpoint.class.getMethod("getResultNoParams")))
      .setPeerAuthenticators(
          ImmutableList.<Class<? extends PeerAuthenticator>>of(InvalidPeerAuthenticator.class));
  try {
    validator.validate(config);
    fail();
  } catch (InvalidConstructorException expected) {
    assertTrue(expected.getMessage().contains("Invalid custom peer authenticator"));
    assertTrue(expected.getMessage().endsWith(
        "InvalidPeerAuthenticator. It must have a public nullary constructor."));
  }
}