@Test public void testInfoEndpointConfiguration() throws Exception { this.context = new AnnotationConfigApplicationContext(); TestUtils.addEnviroment(this.context, "info.foo:bar"); this.context.register(EndpointAutoConfiguration.class); this.context.refresh(); InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class); assertNotNull(endpoint); assertNotNull(endpoint.invoke().get("git")); assertEquals("bar", endpoint.invoke().get("foo")); }
@Test public void testNoGitProperties() throws Exception { this.context = new AnnotationConfigApplicationContext(); TestUtils.addEnviroment(this.context, "spring.git.properties:classpath:nonexistent"); this.context.register(EndpointAutoConfiguration.class); this.context.refresh(); InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class); assertNotNull(endpoint); assertNull(endpoint.invoke().get("git")); }