RestTemplateConfig { protected KerberosRestTemplate getKerberosRestTemplate(String keyTabLocation, String userPrincipal) { return new KerberosRestTemplate(keyTabLocation, userPrincipal); } @Autowired  RestTemplateConfig(Environment environment); @Bean RestTemplate restTemplate();  }
@Test public void restTemplateShouldReturnProperNonKerberosTemplate() { when(environment.getProperty(MetronRestConstants.KERBEROS_KEYTAB_SPRING_PROPERTY)).thenReturn("metron keytabLocation"); when(environment.getProperty(MetronRestConstants.KERBEROS_PRINCIPLE_SPRING_PROPERTY)).thenReturn("metron principal"); when(environment.getProperty(MetronRestConstants.KERBEROS_ENABLED_SPRING_PROPERTY, Boolean.class, false)).thenReturn(false); verify(restTemplateConfig, times(0)).getKerberosRestTemplate(any(), any()); }