ApolloConfig { public String backend() { return either(either(optionalString(apolloNode, "domain"), optionalString(apolloNode, "backend")), optionalString(root, "domain")) .orElse(""); } @Inject  ApolloConfig(Config configNode); String backend(); boolean enableIncomingRequestLogging(); boolean enableOutgoingRequestLogging(); boolean enableMetaApi();  }
@Test public void testBackendApolloBackend() throws Exception { final Config config = ConfigFactory.parseMap(ImmutableMap.of( "apollo.backend", "foo" )); final ApolloConfig sut = new ApolloConfig(config); assertThat(sut.backend(), is("foo")); }
@Test public void testBackendApolloDomain() throws Exception { final Config config = ConfigFactory.parseMap(ImmutableMap.of( "apollo.domain", "foo" )); final ApolloConfig sut = new ApolloConfig(config); assertThat(sut.backend(), is("foo")); }
@Test public void testBackendDomain() throws Exception { final Config config = ConfigFactory.parseMap(ImmutableMap.of( "domain", "foo" )); final ApolloConfig sut = new ApolloConfig(config); assertThat(sut.backend(), is("foo")); }
@Test public void testBackendDefault() throws Exception { final Config config = ConfigFactory.parseMap(ImmutableMap.of()); final ApolloConfig sut = new ApolloConfig(config); assertThat(sut.backend(), is("")); }