@Test public void should_validate_partition_components() throws Exception { // Given final Object[] partitionComponents = {10L, "DuyHai"}; // When view.validatePartitionComponents(partitionComponents); // Then verify(meta.getCompoundPKProperties().getPartitionComponents()) .validatePartitionComponents("entity", partitionComponents); }
@Test public void should_get_last_clustering_key_name() throws Exception { // Given when(compoundPKProperties.getClusteringComponents().getCQLComponentNames()) .thenReturn(Arrays.asList("id", "date", "type")); // When final String lastClusteringKeyName = view.getLastClusteringKeyName(); // Then assertThat(lastClusteringKeyName).isEqualTo("type"); }
@Test public void should_get_clustering_key_names() throws Exception { // Given when(compoundPKProperties.getClusteringComponents().getCQLComponentNames()) .thenReturn(Arrays.asList("id", "date", "type")); // When final List<String> clusteringKeysName = view.getClusteringKeysName(2); // Then assertThat(clusteringKeysName).containsExactly("id", "date"); }
@Test public void should_validate_clustering_components_IN() throws Exception { // Given final Object[] clusteringComponentsIN = {"Paul", "DuyHai"}; // When view.validateClusteringComponentsIn(clusteringComponentsIN); // Then verify(meta.getCompoundPKProperties().getClusteringComponents()) .validateClusteringComponentsIn("entity", clusteringComponentsIN); }
@Test public void should_get_clustering_order() throws Exception { // Given ClusteringOrder clusteringOrder = new ClusteringOrder("column", Sorting.DESC); when(meta.structure().isClustered()).thenReturn(true); when(meta.getCompoundPKProperties().getClusteringComponents().getClusteringOrders()) .thenReturn(Arrays.asList(clusteringOrder)); // When final ClusteringOrder actual = view.getClusteringOrder(); // Then assertThat(actual).isSameAs(clusteringOrder); }