### Question:
DiffGeneratedPartitionPredicate implements PartitionPredicate { @Override public short getPartitionPredicateLimit() { if (Strings.isNullOrEmpty(getPartitionPredicate())) { return 0; } return partitionLimit; } DiffGeneratedPartitionPredicate(
      @Nonnull HiveEndpoint source,
      @Nonnull HiveEndpoint replica,
      TableReplication tableReplication,
      Function<Path, String> checksumFunction); @Override String getPartitionPredicate(); @Override short getPartitionPredicateLimit();  }### Answer:
@Test public void partitionPredicateLimit() throws Exception { when(replica.getTableAndStatistics(tableReplication)).thenReturn(replicaTableAndStats); when(replicaTableAndStats.getTable()).thenReturn(table2); when(sourceTable.getPartitionLimit()).thenReturn((short) 10); predicate = new DiffGeneratedPartitionPredicate(source, replica, tableReplication, checksumFunction); assertThat(predicate.getPartitionPredicateLimit(), is((short) 10)); }
@Test public void noPartitionPredicateLimitSetDefaultsToMinus1() throws Exception { when(replica.getTableAndStatistics(tableReplication)).thenReturn(replicaTableAndStats); when(replicaTableAndStats.getTable()).thenReturn(table2); when(sourceTable.getPartitionLimit()).thenReturn(null); predicate = new DiffGeneratedPartitionPredicate(source, replica, tableReplication, checksumFunction); assertThat(predicate.getPartitionPredicateLimit(), is((short) -1)); }
@Test public void partitionPredicateLimitOverriddenToZeroWhenNoDiffs() throws Exception { when(sourceTableAndStats.getTable()).thenReturn(table2); when(replica.getTableAndStatistics(tableReplication)).thenReturn(replicaTableAndStats); when(replicaTableAndStats.getTable()).thenReturn(table2); when(sourceTable.getPartitionLimit()).thenReturn((short) 10); predicate = new DiffGeneratedPartitionPredicate(source, replica, tableReplication, checksumFunction); assertThat(predicate.getPartitionPredicateLimit(), is((short) 0)); }