GuestFeedSubscriber { String determineGuestHostAndPort() { return defaultString(getenv(GUEST_URI_ENV_PROPERTY_KEY), "localhost:8080"); }  @PostConstruct void init(); @Schedule(minute = "*/1", hour = "*") void updateFeed();  }
@Test public void if_the_environment_variable_is_unset_the_guest_url_defaults_to_localhost() { assumeThat(getenv(GUEST_URI_ENV_PROPERTY_KEY), is(nullValue())); assertThat(new GuestFeedSubscriber().determineGuestHostAndPort()).isEqualTo("localhost:8080"); }
@Test public void if_the_environment_variable_is_set_the_guest_url_is_configured() { mockStatic(System.class); final String expectedConfig = "HOST:PORT"; when(System.getenv(GUEST_URI_ENV_PROPERTY_KEY)).thenReturn(expectedConfig); assertThat(new GuestFeedSubscriber().determineGuestHostAndPort()).isEqualTo(expectedConfig); }