test_class.file: booking/src/test/java/org/koenighotze/jee7hotel/booking/business/json/ReservationBodyReaderTest.java
test_class.identifier: ReservationBodyReaderTest
test_case.body: @Test
      public void a_json_reservation_can_be_read() throws IOException {
          String json = "{\"guestId\":\"9999\",\"reservationNumber\":\"abc-123\",\"checkinDate\":\"2013-01-01\",\"checkoutDate\":\"2013-02-01\",\"assignedRoomId\":\"999\",\"reservationStatus\":\"CLOSED\",\"costsInEuro\":242.23}";
  
          Reservation reservation = new ReservationBodyReader(new ReservationCostCalculator()).readFrom(Reservation.class, null, null, null, null, new ByteArrayInputStream(json.getBytes()));
          assertThat(reservation).isNotNull();
          assertThat(reservation.getGuest()).isEqualTo("9999");
          assertThat(reservation.getReservationNumber()).isEqualTo("abc-123");
          assertThat(reservation.getCostsInEuro()).isEqualTo(new BigDecimal("242.23"));
          assertThat(reservation.getReservationStatus()).isEqualTo(OPEN);
          assertThat(reservation.getCheckinDate()).isEqualTo(of(2013, 1, 1));
          assertThat(reservation.getCheckoutDate()).isEqualTo(of(2013, 2, 1));
          assertThat(reservation.getAssignedRoom()).isEqualTo("999");
      }
test_case.class_method_signature: ReservationBodyReaderTest.a_json_reservation_can_be_read()
test_case.full_signature: @Test public void a_json_reservation_can_be_read()
test_case.identifier: a_json_reservation_can_be_read
test_case.invocations: readFrom getBytes isNotNull assertThat isEqualTo assertThat getGuest isEqualTo assertThat getReservationNumber isEqualTo assertThat getCostsInEuro isEqualTo assertThat getReservationStatus isEqualTo assertThat getCheckinDate of isEqualTo assertThat getCheckoutDate of isEqualTo assertThat getAssignedRoom
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void a_json_reservation_can_be_read()
focal_class.declarator: reservationCostCalculator
focal_class.modifier: private
focal_class.original_string: private ReservationCostCalculator reservationCostCalculator;
focal_class.type: ReservationCostCalculator
focal_class.var_name: reservationCostCalculator
focal_class.file: booking/src/main/java/org/koenighotze/jee7hotel/booking/business/json/ReservationBodyReader.java
focal_class.identifier: ReservationBodyReader
focal_class.interfaces: implements MessageBodyReader<Reservation>
focal_class.class_method_signature: ReservationBodyReader.ReservationBodyReader()
focal_class.full_signature: public  ReservationBodyReader()
focal_class.identifier: ReservationBodyReader
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  ReservationBodyReader()
focal_class.class_method_signature: ReservationBodyReader.ReservationBodyReader(ReservationCostCalculator reservationCostCalculator)
focal_class.full_signature: @Inject public  ReservationBodyReader(ReservationCostCalculator reservationCostCalculator)
focal_class.identifier: ReservationBodyReader
focal_class.modifiers: @Inject public
focal_class.parameters: (ReservationCostCalculator reservationCostCalculator)
focal_class.signature:  ReservationBodyReader(ReservationCostCalculator reservationCostCalculator)
focal_class.class_method_signature: ReservationBodyReader.isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.full_signature: @Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.identifier: isReadable
focal_class.modifiers: @Override public
focal_class.parameters: (Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.return: boolean
focal_class.signature: boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.class_method_signature: ReservationBodyReader.readFrom(Class<Reservation> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
focal_class.full_signature: @Override public Reservation readFrom(Class<Reservation> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
focal_class.identifier: readFrom
focal_class.modifiers: @Override public
focal_class.parameters: (Class<Reservation> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
focal_class.return: Reservation
focal_class.signature: Reservation readFrom(Class<Reservation> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
focal_method.body: @Override
      public Reservation readFrom(Class<Reservation> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException {
          JsonReader reader = Json.createReader(entityStream);
  
          JsonObject jsonObject = reader.readObject();
  
          DateTimeFormatter formatter = ofPattern("yyyy-MM-dd");
          LocalDate checkin = parse(requireNonNull(jsonObject.getString(CHECKINDATE.fieldName())), formatter);
          LocalDate checkout = parse(requireNonNull(jsonObject.getString(CHECKOUTDATE.fieldName())), formatter);
  
          BigDecimal cost = null;
          if (null == jsonObject.getJsonNumber(COSTSINEURO.fieldName())) {
              cost = reservationCostCalculator.calculateRateFor(STANDARD, checkin, checkout);
          } else {
              cost = jsonObject.getJsonNumber(COSTSINEURO.fieldName()).bigDecimalValue();
          }
  
          return new Reservation(requireNonNull(jsonObject.getString(GUESTID.fieldName())),
                  jsonObject.getString(RESERVATIONNUMBER.fieldName(), ""),
                  requireNonNull(jsonObject.getString(ASSIGNEDROOMID.fieldName())),
                  checkin,
                  checkout,
                  cost);
      }
focal_method.class_method_signature: ReservationBodyReader.readFrom(Class<Reservation> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
focal_method.full_signature: @Override public Reservation readFrom(Class<Reservation> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
focal_method.identifier: readFrom
focal_method.invocations: createReader readObject ofPattern parse requireNonNull getString fieldName parse requireNonNull getString fieldName getJsonNumber fieldName calculateRateFor bigDecimalValue getJsonNumber fieldName requireNonNull getString fieldName getString fieldName requireNonNull getString fieldName
focal_method.modifiers: @Override public
focal_method.parameters: (Class<Reservation> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
focal_method.return: Reservation
focal_method.signature: Reservation readFrom(Class<Reservation> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream)