ReservationStatusConverter implements AttributeConverter<ReservationStatus, String> { @Override public String convertToDatabaseColumn(ReservationStatus x) { if (null == x) { return ""; } return x.name(); }  @Override String convertToDatabaseColumn(ReservationStatus x); @Override ReservationStatus convertToEntityAttribute(String y);  }
@Test public void the_conversion_of_a_value_uses_the_values_name() { String value = new ReservationStatusConverter().convertToDatabaseColumn(CANCELED); assertThat(value).isEqualTo(CANCELED.name()); }
@Test public void the_conversion_of_a_null_is_the_empty_string() { String value = new ReservationStatusConverter().convertToDatabaseColumn(null); assertThat(value).isEmpty(); }