test_class.declarator: response
test_class.modifier: @Mocked
      private
test_class.original_string: @Mocked
      private CloseableHttpResponse response;
test_class.type: CloseableHttpResponse
test_class.var_name: response
test_class.declarator: client
test_class.modifier: @Mocked
      private
test_class.original_string: @Mocked
      private CloseableHttpClient client;
test_class.type: CloseableHttpClient
test_class.var_name: client
test_class.declarator: builder
test_class.modifier: @Mocked
      private
test_class.original_string: @Mocked
      private HttpClientBuilder builder;
test_class.type: HttpClientBuilder
test_class.var_name: builder
test_class.file: framework/application/src/test/java/org/koenighotze/jee7hotel/framework/application/registry/ServiceRegistrationTest.java
test_class.identifier: ServiceRegistrationTest
test_case.body: @Test
      public void null_is_returned_if_the_service_is_not_found() throws IOException {
          prepareExpectations(SC_NOT_FOUND);
  
          ServiceRegistration serviceRegistration = new ServiceRegistration();
  
          assertThat(serviceRegistration.getAddNewReservationUrl()).isNull();
      }
test_case.class_method_signature: ServiceRegistrationTest.null_is_returned_if_the_service_is_not_found()
test_case.full_signature: @Test public void null_is_returned_if_the_service_is_not_found()
test_case.identifier: null_is_returned_if_the_service_is_not_found
test_case.invocations: prepareExpectations isNull assertThat getAddNewReservationUrl
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void null_is_returned_if_the_service_is_not_found()
focal_class.declarator: LOGGER = Logger.getLogger(ServiceRegistration.class.getName())
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = Logger.getLogger(ServiceRegistration.class.getName());
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: ADD_NEW_RESERVATION_URL = "http://localhost:8080/booking/add_new_reservation.html"
focal_class.modifier: private static final
focal_class.original_string: private static final String ADD_NEW_RESERVATION_URL = "http://localhost:8080/booking/add_new_reservation.html";
focal_class.type: String
focal_class.var_name: ADD_NEW_RESERVATION_URL
focal_class.declarator: HOST_URL = "http://localhost:8080"
focal_class.modifier: private static final
focal_class.original_string: private static final String HOST_URL = "http://localhost:8080";
focal_class.type: String
focal_class.var_name: HOST_URL
focal_class.declarator: MINUTES_PER_CHECK = 1L
focal_class.modifier: private final
focal_class.original_string: private final long MINUTES_PER_CHECK = 1L;
focal_class.type: long
focal_class.var_name: MINUTES_PER_CHECK
focal_class.declarator: available = false
focal_class.modifier: private
focal_class.original_string: private boolean available = false;
focal_class.type: boolean
focal_class.var_name: available
focal_class.declarator: lastCheck = now().minusDays(1L)
focal_class.modifier: private
focal_class.original_string: private LocalDateTime lastCheck = now().minusDays(1L);
focal_class.type: LocalDateTime
focal_class.var_name: lastCheck
focal_class.file: framework/application/src/main/java/org/koenighotze/jee7hotel/framework/application/registry/ServiceRegistration.java
focal_class.identifier: ServiceRegistration
focal_class.class_method_signature: ServiceRegistration.getAddNewReservationUrl()
focal_class.full_signature: @Produces @AddReservationUrl public String getAddNewReservationUrl()
focal_class.identifier: getAddNewReservationUrl
focal_class.modifiers: @Produces @AddReservationUrl public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getAddNewReservationUrl()
focal_method.body: @Produces
      @AddReservationUrl
      public String getAddNewReservationUrl() {
          if (lastCheck.isBefore(now().minusMinutes(MINUTES_PER_CHECK))) {
              available = false;
  
              // this is obviously bad...but ok for our example
              LOGGER.info(() -> "Checking availability of " + ADD_NEW_RESERVATION_URL);
              SocketConfig socketConfig = copy(DEFAULT).setSoTimeout(2000).build();
              try (CloseableHttpClient client = HttpClientBuilder.create().setDefaultSocketConfig(socketConfig).build(); CloseableHttpResponse response = client.execute(HttpHost.create(HOST_URL), new HttpGet(ADD_NEW_RESERVATION_URL))) {
                  available = SC_OK == response.getStatusLine().getStatusCode();
  
                  if (SC_OK != response.getStatusLine().getStatusCode()) {
                      LOGGER.log(WARNING, () -> "Cannot access url for new reservations!");
                  }
              } catch (IOException e) {
                  LOGGER.log(SEVERE, e, () -> "Cannot access url for new reservations!");
              }
          }
  
          return available ? ADD_NEW_RESERVATION_URL : null;
      }
focal_method.class_method_signature: ServiceRegistration.getAddNewReservationUrl()
focal_method.full_signature: @Produces @AddReservationUrl public String getAddNewReservationUrl()
focal_method.identifier: getAddNewReservationUrl
focal_method.invocations: isBefore minusMinutes now info build setSoTimeout copy build setDefaultSocketConfig create execute create getStatusCode getStatusLine getStatusCode getStatusLine log log
focal_method.modifiers: @Produces @AddReservationUrl public
focal_method.parameters: ()
focal_method.return: String
focal_method.signature: String getAddNewReservationUrl()