HiveNotificationHandler { public void handlePartitionCreated(String roadName, Partition partition, String partitionSpec, long recordCount) { checkNotNull(partition); notificationHandler.send(HivePartitionCreated .builder() .roadName(roadName) .metastoreUris(hiveMetaStoreUris) .databaseName(partition.getDbName()) .tableName(partition.getTableName()) .partitionSpec(partitionSpec) .locationUri(partition.getSd().getLocation()) .recordCount(recordCount) .build()); } @Autowired  HiveNotificationHandler(
      NotificationHandler notificationHandler,
      @Value("${hive.metastore.uris}") String hiveMetaStoreUris,
      @Value("${hive.database}") String hiveDatabase); void handlePartitionCreated(String roadName, Partition partition, String partitionSpec, long recordCount); void handleHiveTableCreated(
      String roadName,
      String tableName,
      String partitionColumnName,
      String baseLocation);  }
@Test public void hivePartitionCreated() { when(partition.getDbName()).thenReturn(DATABASE_NAME); when(partition.getTableName()).thenReturn(TABLE_NAME); when(partition.getSd()).thenReturn(sd); when(sd.getLocation()).thenReturn(LOCATION_URI); doNothing().when(notificationHandler).send(hivePartitionCreatedCaptor.capture()); underTest = new HiveNotificationHandler(notificationHandler, HIVE_METASTORE_URIS, DATABASE_NAME); underTest.handlePartitionCreated(ROAD_NAME, partition, PARTITION_SPEC, 1L); HivePartitionCreated notification = hivePartitionCreatedCaptor.getValue(); assertThat(notification.getDatabaseName(), is(DATABASE_NAME)); assertThat(notification.getLocationUri(), is(LOCATION_URI)); assertThat(notification.getMetastoreUris(), is(HIVE_METASTORE_URIS)); assertThat(notification.getPartitionSpec(), is(PARTITION_SPEC)); assertThat(notification.getRecordCount(), is(1L)); assertThat(notification.getProtocolVersion(), is("1.0")); assertThat(notification.getType(), is(RoadNotificationType.HIVE_PARTITION_CREATED)); assertThat(notification.getRoadName(), is(ROAD_NAME)); assertThat(notification.getTableName(), is(TABLE_NAME)); }