@@ -40,17 +40,17 @@ public class FilteredResultTest {
4040 .addClusteringKey (ACCOUNT_TYPE )
4141 .build ());
4242
43- private static final IntValue ACCOUNT_ID_VALUE = new IntValue (ACCOUNT_ID , 0 );
44- private static final IntValue ACCOUNT_TYPE_VALUE = new IntValue (ACCOUNT_TYPE , 1 );
45- private static final IntValue BALANCE_VALUE = new IntValue (BALANCE , 2 );
43+ private static final IntColumn ACCOUNT_ID_VALUE = IntColumn . of (ACCOUNT_ID , 0 );
44+ private static final IntColumn ACCOUNT_TYPE_VALUE = IntColumn . of (ACCOUNT_TYPE , 1 );
45+ private static final IntColumn BALANCE_VALUE = IntColumn . of (BALANCE , 2 );
4646 private static final TextColumn ID_VALUE = TextColumn .of (Attribute .ID , "aaa" );
4747 private static final IntColumn STATE_VALUE =
4848 IntColumn .of (Attribute .STATE , TransactionState .COMMITTED .get ());
4949 private static final IntColumn VERSION_VALUE = IntColumn .of (Attribute .VERSION , 4 );
5050 private static final BigIntColumn PREPARED_AT_VALUE = BigIntColumn .of (Attribute .PREPARED_AT , 5 );
5151 private static final BigIntColumn COMMITTED_AT_VALUE = BigIntColumn .of (Attribute .COMMITTED_AT , 6 );
52- private static final IntValue BEFORE_BALANCE_VALUE =
53- new IntValue (Attribute .BEFORE_PREFIX + BALANCE , 7 );
52+ private static final IntColumn BEFORE_BALANCE_VALUE =
53+ IntColumn . of (Attribute .BEFORE_PREFIX + BALANCE , 7 );
5454 private static final TextColumn BEFORE_ID_VALUE = TextColumn .of (Attribute .BEFORE_ID , "bbb" );
5555 private static final IntColumn BEFORE_STATE_VALUE =
5656 IntColumn .of (Attribute .BEFORE_STATE , TransactionState .COMMITTED .get ());
@@ -67,15 +67,15 @@ public void setUp() {
6767 // Arrange
6868 Map <String , Column <?>> columns =
6969 ImmutableMap .<String , Column <?>>builder ()
70- .put (ACCOUNT_ID , ScalarDbUtils . toColumn ( ACCOUNT_ID_VALUE ) )
71- .put (ACCOUNT_TYPE , ScalarDbUtils . toColumn ( ACCOUNT_TYPE_VALUE ) )
72- .put (BALANCE , ScalarDbUtils . toColumn ( BALANCE_VALUE ) )
70+ .put (ACCOUNT_ID , ACCOUNT_ID_VALUE )
71+ .put (ACCOUNT_TYPE , ACCOUNT_TYPE_VALUE )
72+ .put (BALANCE , BALANCE_VALUE )
7373 .put (Attribute .ID , ID_VALUE )
7474 .put (Attribute .STATE , STATE_VALUE )
7575 .put (Attribute .VERSION , VERSION_VALUE )
7676 .put (Attribute .PREPARED_AT , PREPARED_AT_VALUE )
7777 .put (Attribute .COMMITTED_AT , COMMITTED_AT_VALUE )
78- .put (Attribute .BEFORE_PREFIX + BALANCE , ScalarDbUtils . toColumn ( BEFORE_BALANCE_VALUE ) )
78+ .put (Attribute .BEFORE_PREFIX + BALANCE , BEFORE_BALANCE_VALUE )
7979 .put (Attribute .BEFORE_ID , BEFORE_ID_VALUE )
8080 .put (Attribute .BEFORE_STATE , BEFORE_STATE_VALUE )
8181 .put (Attribute .BEFORE_VERSION , BEFORE_VERSION_VALUE )
@@ -94,19 +94,24 @@ public void withoutProjections_ShouldFilterOutTransactionMetaColumns() {
9494
9595 // Act Assert
9696 assertThat (filteredResult .getPartitionKey ()).isPresent ();
97- assertThat (filteredResult .getPartitionKey ().get ().size ()).isEqualTo (1 );
98- assertThat (filteredResult .getPartitionKey ().get ().get ().get (0 )).isEqualTo (ACCOUNT_ID_VALUE );
97+ assertThat (filteredResult .getPartitionKey ().get ().getColumns ().size ()).isEqualTo (1 );
98+ assertThat (filteredResult .getPartitionKey ().get ().getColumns ().get (0 ))
99+ .isEqualTo (ACCOUNT_ID_VALUE );
99100
100101 assertThat (filteredResult .getClusteringKey ()).isPresent ();
101- assertThat (filteredResult .getClusteringKey ().get ().size ()).isEqualTo (1 );
102- assertThat (filteredResult .getClusteringKey ().get ().get ().get (0 )).isEqualTo (ACCOUNT_TYPE_VALUE );
102+ assertThat (filteredResult .getClusteringKey ().get ().getColumns ().size ()).isEqualTo (1 );
103+ assertThat (filteredResult .getClusteringKey ().get ().getColumns ().get (0 ))
104+ .isEqualTo (ACCOUNT_TYPE_VALUE );
103105
104106 assertThat (filteredResult .getValue (ACCOUNT_ID ).isPresent ()).isTrue ();
105- assertThat (filteredResult .getValue (ACCOUNT_ID ).get ()).isEqualTo (ACCOUNT_ID_VALUE );
107+ assertThat (filteredResult .getValue (ACCOUNT_ID ).get ())
108+ .isEqualTo (ScalarDbUtils .toValue (ACCOUNT_ID_VALUE ));
106109 assertThat (filteredResult .getValue (ACCOUNT_TYPE ).isPresent ()).isTrue ();
107- assertThat (filteredResult .getValue (ACCOUNT_TYPE ).get ()).isEqualTo (ACCOUNT_TYPE_VALUE );
110+ assertThat (filteredResult .getValue (ACCOUNT_TYPE ).get ())
111+ .isEqualTo (ScalarDbUtils .toValue (ACCOUNT_TYPE_VALUE ));
108112 assertThat (filteredResult .getValue (BALANCE ).isPresent ()).isTrue ();
109- assertThat (filteredResult .getValue (BALANCE ).get ()).isEqualTo (BALANCE_VALUE );
113+ assertThat (filteredResult .getValue (BALANCE ).get ())
114+ .isEqualTo (ScalarDbUtils .toValue (BALANCE_VALUE ));
110115
111116 assertThat (filteredResult .getValue (Attribute .ID )).isNotPresent ();
112117 assertThat (filteredResult .getValue (Attribute .STATE )).isNotPresent ();
@@ -159,18 +164,24 @@ public void withoutProjectionsAndIncludeMetadataEnabled_ShouldContainAllColumns(
159164
160165 // Act Assert
161166 assertThat (filteredResult .getPartitionKey ()).isPresent ();
162- assertThat (filteredResult .getPartitionKey ().get ().size ()).isEqualTo (1 );
163- assertThat (filteredResult .getPartitionKey ().get ().get ().get (0 )).isEqualTo (ACCOUNT_ID_VALUE );
167+ assertThat (filteredResult .getPartitionKey ().get ().getColumns ().size ()).isEqualTo (1 );
168+ assertThat (filteredResult .getPartitionKey ().get ().getColumns ().get (0 ))
169+ .isEqualTo (ACCOUNT_ID_VALUE );
164170
165171 assertThat (filteredResult .getClusteringKey ()).isPresent ();
166172 assertThat (filteredResult .getClusteringKey ().get ().size ()).isEqualTo (1 );
167- assertThat (filteredResult .getClusteringKey ().get ().get ().get (0 )).isEqualTo (ACCOUNT_TYPE_VALUE );
173+ assertThat (filteredResult .getClusteringKey ().get ().getColumns ().get (0 ))
174+ .isEqualTo (ACCOUNT_TYPE_VALUE );
175+
168176 assertThat (filteredResult .getValue (ACCOUNT_ID ).isPresent ()).isTrue ();
169- assertThat (filteredResult .getValue (ACCOUNT_ID ).get ()).isEqualTo (ACCOUNT_ID_VALUE );
177+ assertThat (filteredResult .getValue (ACCOUNT_ID ).get ())
178+ .isEqualTo (ScalarDbUtils .toValue (ACCOUNT_ID_VALUE ));
170179 assertThat (filteredResult .getValue (ACCOUNT_TYPE ).isPresent ()).isTrue ();
171- assertThat (filteredResult .getValue (ACCOUNT_TYPE ).get ()).isEqualTo (ACCOUNT_TYPE_VALUE );
180+ assertThat (filteredResult .getValue (ACCOUNT_TYPE ).get ())
181+ .isEqualTo (ScalarDbUtils .toValue (ACCOUNT_TYPE_VALUE ));
172182 assertThat (filteredResult .getValue (BALANCE ).isPresent ()).isTrue ();
173- assertThat (filteredResult .getValue (BALANCE ).get ()).isEqualTo (BALANCE_VALUE );
183+ assertThat (filteredResult .getValue (BALANCE ).get ())
184+ .isEqualTo (ScalarDbUtils .toValue (BALANCE_VALUE ));
174185
175186 assertThat (filteredResult .getValue (Attribute .ID )).isPresent ();
176187 assertThat (filteredResult .getValue (Attribute .ID ).get ())
@@ -189,7 +200,7 @@ public void withoutProjectionsAndIncludeMetadataEnabled_ShouldContainAllColumns(
189200 .isEqualTo (new BigIntValue (Attribute .COMMITTED_AT , 6 ));
190201 assertThat (filteredResult .getValue (Attribute .BEFORE_PREFIX + BALANCE )).isPresent ();
191202 assertThat (filteredResult .getValue (Attribute .BEFORE_PREFIX + BALANCE ).get ())
192- .isEqualTo (BEFORE_BALANCE_VALUE );
203+ .isEqualTo (ScalarDbUtils . toValue ( BEFORE_BALANCE_VALUE ) );
193204 assertThat (filteredResult .getValue (Attribute .BEFORE_ID )).isPresent ();
194205 assertThat (filteredResult .getValue (Attribute .BEFORE_ID ).get ())
195206 .isEqualTo (new TextValue (Attribute .BEFORE_ID , "bbb" ));
@@ -305,17 +316,20 @@ public void withProjections_ShouldFilterOutUnprojectedColumnsAndTransactionMetaC
305316
306317 // Act Assert
307318 assertThat (filteredResult .getPartitionKey ()).isPresent ();
308- assertThat (filteredResult .getPartitionKey ().get ().size ()).isEqualTo (1 );
309- assertThat (filteredResult .getPartitionKey ().get ().get ().get (0 )).isEqualTo (ACCOUNT_ID_VALUE );
319+ assertThat (filteredResult .getPartitionKey ().get ().getColumns ().size ()).isEqualTo (1 );
320+ assertThat (filteredResult .getPartitionKey ().get ().getColumns ().get (0 ))
321+ .isEqualTo (ACCOUNT_ID_VALUE );
310322
311323 assertThat (catchThrowable (filteredResult ::getClusteringKey ))
312324 .isInstanceOf (IllegalStateException .class );
313325
314326 assertThat (filteredResult .getValue (ACCOUNT_ID ).isPresent ()).isTrue ();
315- assertThat (filteredResult .getValue (ACCOUNT_ID ).get ()).isEqualTo (ACCOUNT_ID_VALUE );
327+ assertThat (filteredResult .getValue (ACCOUNT_ID ).get ())
328+ .isEqualTo (ScalarDbUtils .toValue (ACCOUNT_ID_VALUE ));
316329 assertThat (filteredResult .getValue (ACCOUNT_TYPE )).isNotPresent ();
317330 assertThat (filteredResult .getValue (BALANCE ).isPresent ()).isTrue ();
318- assertThat (filteredResult .getValue (BALANCE ).get ()).isEqualTo (BALANCE_VALUE );
331+ assertThat (filteredResult .getValue (BALANCE ).get ())
332+ .isEqualTo (ScalarDbUtils .toValue (BALANCE_VALUE ));
319333
320334 assertThat (filteredResult .getValue (Attribute .ID )).isNotPresent ();
321335 assertThat (filteredResult .getValue (Attribute .STATE )).isNotPresent ();
@@ -370,17 +384,20 @@ public void withProjectionsAndIncludeMetadataEnabled_ShouldNotIncludeNonProjecte
370384
371385 // Act Assert
372386 assertThat (filteredResult .getPartitionKey ()).isPresent ();
373- assertThat (filteredResult .getPartitionKey ().get ().size ()).isEqualTo (1 );
374- assertThat (filteredResult .getPartitionKey ().get ().get ().get (0 )).isEqualTo (ACCOUNT_ID_VALUE );
387+ assertThat (filteredResult .getPartitionKey ().get ().getColumns ().size ()).isEqualTo (1 );
388+ assertThat (filteredResult .getPartitionKey ().get ().getColumns ().get (0 ))
389+ .isEqualTo (ACCOUNT_ID_VALUE );
375390
376391 assertThat (catchThrowable (filteredResult ::getClusteringKey ))
377392 .isInstanceOf (IllegalStateException .class );
378393
379394 assertThat (filteredResult .getValue (ACCOUNT_ID ).isPresent ()).isTrue ();
380- assertThat (filteredResult .getValue (ACCOUNT_ID ).get ()).isEqualTo (ACCOUNT_ID_VALUE );
395+ assertThat (filteredResult .getValue (ACCOUNT_ID ).get ())
396+ .isEqualTo (ScalarDbUtils .toValue (ACCOUNT_ID_VALUE ));
381397 assertThat (filteredResult .getValue (ACCOUNT_TYPE )).isNotPresent ();
382398 assertThat (filteredResult .getValue (BALANCE ).isPresent ()).isTrue ();
383- assertThat (filteredResult .getValue (BALANCE ).get ()).isEqualTo (BALANCE_VALUE );
399+ assertThat (filteredResult .getValue (BALANCE ).get ())
400+ .isEqualTo (ScalarDbUtils .toValue (BALANCE_VALUE ));
384401
385402 assertThat (filteredResult .getValue (Attribute .ID )).isNotPresent ();
386403 assertThat (filteredResult .getValue (Attribute .STATE )).isNotPresent ();
@@ -391,7 +408,7 @@ public void withProjectionsAndIncludeMetadataEnabled_ShouldNotIncludeNonProjecte
391408 assertThat (filteredResult .getValue (Attribute .COMMITTED_AT )).isNotPresent ();
392409 assertThat (filteredResult .getValue (Attribute .BEFORE_PREFIX + BALANCE )).isPresent ();
393410 assertThat (filteredResult .getValue (Attribute .BEFORE_PREFIX + BALANCE ).get ())
394- .isEqualTo (BEFORE_BALANCE_VALUE );
411+ .isEqualTo (ScalarDbUtils . toValue ( BEFORE_BALANCE_VALUE ) );
395412 assertThat (filteredResult .getValue (Attribute .BEFORE_ID )).isNotPresent ();
396413 assertThat (filteredResult .getValue (Attribute .BEFORE_STATE )).isNotPresent ();
397414 assertThat (filteredResult .getValue (Attribute .BEFORE_VERSION )).isNotPresent ();
@@ -445,14 +462,16 @@ public void withProjectionsAndIncludeMetadataEnabled_ShouldNotIncludeNonProjecte
445462
446463 // Act Assert
447464 assertThat (filteredResult .getPartitionKey ()).isPresent ();
448- assertThat (filteredResult .getPartitionKey ().get ().size ()).isEqualTo (1 );
449- assertThat (filteredResult .getPartitionKey ().get ().get ().get (0 )).isEqualTo (ACCOUNT_ID_VALUE );
465+ assertThat (filteredResult .getPartitionKey ().get ().getColumns ().size ()).isEqualTo (1 );
466+ assertThat (filteredResult .getPartitionKey ().get ().getColumns ().get (0 ))
467+ .isEqualTo (ACCOUNT_ID_VALUE );
450468
451469 assertThat (catchThrowable (filteredResult ::getClusteringKey ))
452470 .isInstanceOf (IllegalStateException .class );
453471
454472 assertThat (filteredResult .getValue (ACCOUNT_ID ).isPresent ()).isTrue ();
455- assertThat (filteredResult .getValue (ACCOUNT_ID ).get ()).isEqualTo (ACCOUNT_ID_VALUE );
473+ assertThat (filteredResult .getValue (ACCOUNT_ID ).get ())
474+ .isEqualTo (ScalarDbUtils .toValue (ACCOUNT_ID_VALUE ));
456475 assertThat (filteredResult .getValue (ACCOUNT_TYPE )).isNotPresent ();
457476 assertThat (filteredResult .getValue (BALANCE )).isNotPresent ();
458477
@@ -505,13 +524,14 @@ public void withProjectionsAndIncludeMetadataEnabled_ShouldNotIncludeNonProjecte
505524 .isInstanceOf (IllegalStateException .class );
506525
507526 assertThat (filteredResult .getClusteringKey ()).isPresent ();
508- assertThat (filteredResult .getClusteringKey ().get ().size ()).isEqualTo (1 );
509-
510- assertThat ( filteredResult . getClusteringKey (). get (). get (). get ( 0 )) .isEqualTo (ACCOUNT_TYPE_VALUE );
527+ assertThat (filteredResult .getClusteringKey ().get ().getColumns (). size ()).isEqualTo (1 );
528+ assertThat ( filteredResult . getClusteringKey (). get (). getColumns (). get ( 0 ))
529+ .isEqualTo (ACCOUNT_TYPE_VALUE );
511530
512531 assertThat (filteredResult .getValue (ACCOUNT_ID )).isNotPresent ();
513532 assertThat (filteredResult .getValue (ACCOUNT_TYPE ).isPresent ()).isTrue ();
514- assertThat (filteredResult .getValue (ACCOUNT_TYPE ).get ()).isEqualTo (ACCOUNT_TYPE_VALUE );
533+ assertThat (filteredResult .getValue (ACCOUNT_TYPE ).get ())
534+ .isEqualTo (ScalarDbUtils .toValue (ACCOUNT_TYPE_VALUE ));
515535 assertThat (filteredResult .getValue (BALANCE )).isNotPresent ();
516536
517537 assertThat (filteredResult .getValue (Attribute .ID )).isNotPresent ();
@@ -567,7 +587,8 @@ public void withProjectionsAndIncludeMetadataEnabled_ShouldNotIncludeNonProjecte
567587 assertThat (filteredResult .getValue (ACCOUNT_ID )).isNotPresent ();
568588 assertThat (filteredResult .getValue (ACCOUNT_TYPE )).isNotPresent ();
569589 assertThat (filteredResult .getValue (BALANCE ).isPresent ()).isTrue ();
570- assertThat (filteredResult .getValue (BALANCE ).get ()).isEqualTo (BALANCE_VALUE );
590+ assertThat (filteredResult .getValue (BALANCE ).get ())
591+ .isEqualTo (ScalarDbUtils .toValue (BALANCE_VALUE ));
571592
572593 assertThat (filteredResult .getValue (Attribute .ID )).isNotPresent ();
573594 assertThat (filteredResult .getValue (Attribute .STATE )).isNotPresent ();
@@ -664,11 +685,11 @@ public void equals_ResultImplWithSameValuesGiven_WithoutProjections_ShouldReturn
664685 new ResultImpl (
665686 ImmutableMap .of (
666687 ACCOUNT_ID ,
667- ScalarDbUtils . toColumn ( ACCOUNT_ID_VALUE ) ,
688+ ACCOUNT_ID_VALUE ,
668689 ACCOUNT_TYPE ,
669- ScalarDbUtils . toColumn ( ACCOUNT_TYPE_VALUE ) ,
690+ ACCOUNT_TYPE_VALUE ,
670691 BALANCE ,
671- ScalarDbUtils . toColumn ( BALANCE_VALUE ) ),
692+ BALANCE_VALUE ),
672693 TABLE_METADATA );
673694
674695 // Act
@@ -696,9 +717,7 @@ public void equals_ResultImplWithDifferentValuesGiven_WithProjections_ShouldRetu
696717 // Arrange
697718 Result filteredResult =
698719 new FilteredResult (result , Collections .singletonList (BALANCE ), TABLE_METADATA , false );
699- Result anotherResult =
700- new ResultImpl (
701- ImmutableMap .of (BALANCE , ScalarDbUtils .toColumn (BALANCE_VALUE )), TABLE_METADATA );
720+ Result anotherResult = new ResultImpl (ImmutableMap .of (BALANCE , BALANCE_VALUE ), TABLE_METADATA );
702721
703722 // Act
704723 boolean isEqual = filteredResult .equals (anotherResult );
0 commit comments