aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/serialization/ObjectCodecRegistryTest.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/serialization/ObjectCodecRegistryTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/serialization/ObjectCodecRegistryTest.java
index dca168b6c6..b5272defcc 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/serialization/ObjectCodecRegistryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/serialization/ObjectCodecRegistryTest.java
@@ -118,15 +118,15 @@ public class ObjectCodecRegistryTest {
ObjectCodecRegistry underTest1 =
ObjectCodecRegistry.newBuilder()
.setAllowDefaultCodec(false)
- .addConstant(constant1)
- .addConstant(constant2)
- .addConstant(constant1)
+ .addReferenceConstant(constant1)
+ .addReferenceConstant(constant2)
+ .addReferenceConstant(constant1)
.build();
ObjectCodecRegistry underTest2 =
ObjectCodecRegistry.newBuilder()
.setAllowDefaultCodec(false)
- .addConstant(constant1)
- .addConstant(constant2)
+ .addReferenceConstant(constant1)
+ .addReferenceConstant(constant2)
.build();
assertThat(underTest1.maybeGetTagForConstant(constant1)).isEqualTo(3);
assertThat(underTest1.maybeGetTagForConstant(constant2)).isEqualTo(2);
@@ -135,6 +135,19 @@ public class ObjectCodecRegistryTest {
}
@Test
+ public void valueConstant() {
+ String valueConstant = "ab";
+ ObjectCodecRegistry underTest =
+ ObjectCodecRegistry.newBuilder()
+ .setAllowDefaultCodec(false)
+ .addValueConstant(valueConstant)
+ .build();
+ assertThat(underTest.maybeGetTagForConstant("a")).isNull();
+ assertThat(underTest.maybeGetTagForConstant("ab")).isNotNull();
+ assertThat(underTest.maybeGetTagForConstant("cab".substring(1))).isNotNull();
+ }
+
+ @Test
public void testGetBuilder() throws NoCodecException {
SingletonCodec<String> codec1 = SingletonCodec.of("value1", "mnemonic1");
SingletonCodec<Integer> codec2 = SingletonCodec.of(1, "mnemonic2");
@@ -145,7 +158,7 @@ public class ObjectCodecRegistryTest {
.setAllowDefaultCodec(false)
.add(codec1)
.add(codec2)
- .addConstant(constant)
+ .addReferenceConstant(constant)
.build();
ObjectCodecRegistry copy = underTest.getBuilder().build();