HiveDestinationServiceImpl implements HiveDestinationService { @VisibleForTesting String validateAndNormaliseLandingInterval(String landingInterval) { return Optional .ofNullable(landingInterval) .map(this::parseDuration) .map(this::validateIntervalRange) .map(Duration::toString) .orElse(HiveDestination.DEFAULT_LANDING_INTERVAL); } @Autowired  HiveDestinationServiceImpl(HiveDestinationAdminClient hiveDestinationAdminClient); @Override HiveDestinationModel getHiveDestination(String name); @Override void createHiveDestination(String name, HiveDestinationModel hiveDestinationModel); @Override void updateHiveDestination(String name, HiveDestinationModel hiveDestinationModel); @Override void deleteHiveDestination(String name);  }
@Test public void validLandingInterval() throws Exception { assertThat(underTest.validateAndNormaliseLandingInterval("PT30M"), is("PT30M")); }
@Test public void notSpecifiedInterval() throws Exception { assertThat(underTest.validateAndNormaliseLandingInterval(null), is(HiveDestination.DEFAULT_LANDING_INTERVAL)); }
@Test(expected = InvalidLandingIntervalException.class) public void invalidLandingInterval() throws Exception { underTest.validateAndNormaliseLandingInterval("abc"); }
@Test(expected = InvalidLandingIntervalException.class) public void intervalTooShort() throws Exception { underTest.validateAndNormaliseLandingInterval("PT1M"); }
@Test(expected = InvalidLandingIntervalException.class) public void intervalTooLong() throws Exception { underTest.validateAndNormaliseLandingInterval("P7D"); }