@@ -39,7 +39,8 @@ public class ColorPoolTest {
39
39
@ Test
40
40
public void deserializesJavaScriptPrimitivesFromEmptyTypePool () {
41
41
ColorPool .ShardView colorPool =
42
- ColorPool .fromOnlyShard (TypePool .getDefaultInstance (), StringPool .empty ()).getOnlyShard ();
42
+ ColorPool .fromOnlyShardForTesting (TypePool .getDefaultInstance (), StringPool .empty ())
43
+ .getOnlyShardForTesting ();
43
44
44
45
assertThat (colorPool .getColor (PrimitiveType .NUMBER_TYPE .getNumber ()))
45
46
.isEqualTo (StandardColors .NUMBER );
@@ -53,7 +54,8 @@ public void deserializesJavaScriptPrimitivesFromEmptyTypePool() {
53
54
@ Test
54
55
public void deserializesTopObjectTypeFromEmptyTypePool () {
55
56
ColorPool .ShardView colorPool =
56
- ColorPool .fromOnlyShard (TypePool .getDefaultInstance (), StringPool .empty ()).getOnlyShard ();
57
+ ColorPool .fromOnlyShardForTesting (TypePool .getDefaultInstance (), StringPool .empty ())
58
+ .getOnlyShardForTesting ();
57
59
58
60
Color object = colorPool .getColor (PrimitiveType .TOP_OBJECT .getNumber ());
59
61
assertThat (object ).isInvalidating ();
@@ -83,8 +85,8 @@ public void deserializesNativeObjectTableIntoNativeColor() {
83
85
SubtypingEdge .newBuilder ().setSubtype (poolPointer (0 )).setSupertype (poolPointer (1 )))
84
86
.build ();
85
87
86
- ColorPool colorPool = ColorPool .fromOnlyShard (typePool , stringPool .build ());
87
- ColorPool .ShardView view = colorPool .getOnlyShard ();
88
+ ColorPool colorPool = ColorPool .fromOnlyShardForTesting (typePool , stringPool .build ());
89
+ ColorPool .ShardView view = colorPool .getOnlyShardForTesting ();
88
90
89
91
Color numberObject = colorPool .getColor (StandardColors .NUMBER_OBJECT_ID );
90
92
assertThat (numberObject ).isInvalidating ();
@@ -98,7 +100,7 @@ public void deserializesNativeObjectTableIntoNativeColor() {
98
100
@ Test
99
101
public void testSynthesizesMissingStandardColors () {
100
102
ColorPool colorPool =
101
- ColorPool .fromOnlyShard (TypePool .getDefaultInstance (), StringPool .empty ());
103
+ ColorPool .fromOnlyShardForTesting (TypePool .getDefaultInstance (), StringPool .empty ());
102
104
103
105
for (ColorId id : ColorRegistry .REQUIRED_IDS ) {
104
106
assertThat (colorPool .getColor (id )).hasId (id );
@@ -115,7 +117,7 @@ public void deserializesSimpleObject() {
115
117
ObjectTypeProto .newBuilder ().setUuid (ByteString .copyFromUtf8 ("Foo" ))))
116
118
.build ();
117
119
ColorPool .ShardView colorPool =
118
- ColorPool .fromOnlyShard (typePool , StringPool .empty ()).getOnlyShard ();
120
+ ColorPool .fromOnlyShardForTesting (typePool , StringPool .empty ()).getOnlyShardForTesting ();
119
121
120
122
assertThat (colorPool .getColor (poolPointer (0 )))
121
123
.isEqualTo (Color .singleBuilder ().setId (fromAscii ("Foo" )).build ());
@@ -143,7 +145,7 @@ public void deserializesObjectWithPrototypeAndInstanceType() {
143
145
.setMarkedConstructor (true )))
144
146
.build ();
145
147
ColorPool .ShardView colorPool =
146
- ColorPool .fromOnlyShard (typePool , StringPool .empty ()).getOnlyShard ();
148
+ ColorPool .fromOnlyShardForTesting (typePool , StringPool .empty ()).getOnlyShardForTesting ();
147
149
148
150
assertThat (colorPool .getColor (poolPointer (2 )))
149
151
.isEqualTo (
@@ -168,7 +170,8 @@ public void deserializesPropertiesFromStringPool() {
168
170
.addOwnProperty (2 )))
169
171
.build ();
170
172
StringPool stringPool = StringPool .builder ().putAnd ("x" ).putAnd ("y" ).build ();
171
- ColorPool .ShardView colorPool = ColorPool .fromOnlyShard (typePool , stringPool ).getOnlyShard ();
173
+ ColorPool .ShardView colorPool =
174
+ ColorPool .fromOnlyShardForTesting (typePool , stringPool ).getOnlyShardForTesting ();
172
175
173
176
assertThat (colorPool .getColor (poolPointer (0 )))
174
177
.isEqualTo (
@@ -190,7 +193,7 @@ public void marksInvalidatingObject() {
190
193
.setIsInvalidating (true )))
191
194
.build ();
192
195
ColorPool .ShardView colorPool =
193
- ColorPool .fromOnlyShard (typePool , StringPool .empty ()).getOnlyShard ();
196
+ ColorPool .fromOnlyShardForTesting (typePool , StringPool .empty ()).getOnlyShardForTesting ();
194
197
195
198
assertThat (colorPool .getColor (poolPointer (0 ))).isInvalidating ();
196
199
assertThat (colorPool .getColor (poolPointer (0 )).getId ()).isEqualTo (ColorId .fromAscii ("Foo" ));
@@ -208,7 +211,7 @@ public void marksClosureAssert() {
208
211
.setClosureAssert (true )))
209
212
.build ();
210
213
ColorPool .ShardView colorPool =
211
- ColorPool .fromOnlyShard (typePool , StringPool .empty ()).getOnlyShard ();
214
+ ColorPool .fromOnlyShardForTesting (typePool , StringPool .empty ()).getOnlyShardForTesting ();
212
215
213
216
assertThat (colorPool .getColor (poolPointer (0 ))).isClosureAssert ();
214
217
assertThat (colorPool .getColor (poolPointer (0 )).getId ()).isEqualTo (ColorId .fromAscii ("Foo" ));
@@ -299,7 +302,7 @@ public void throwsErrorIfDisambiguationEdgesContainsInvalidOffset() {
299
302
.build ();
300
303
assertThrows (
301
304
MalformedTypedAstException .class ,
302
- () -> ColorPool .fromOnlyShard (typePool , StringPool .empty ()));
305
+ () -> ColorPool .fromOnlyShardForTesting (typePool , StringPool .empty ()));
303
306
}
304
307
305
308
@ Test
@@ -320,8 +323,8 @@ public void deserializesMultipleUnionsOfNativeTypes() {
320
323
.addUnionMember (PrimitiveType .BIGINT_TYPE .getNumber ())))
321
324
.build ();
322
325
323
- ColorPool colorPool = ColorPool .fromOnlyShard (typePool , StringPool .empty ());
324
- ColorPool .ShardView view = colorPool .getOnlyShard ();
326
+ ColorPool colorPool = ColorPool .fromOnlyShardForTesting (typePool , StringPool .empty ());
327
+ ColorPool .ShardView view = colorPool .getOnlyShardForTesting ();
325
328
326
329
assertThat (view .getColor (poolPointer (0 )))
327
330
.hasAlternates (StandardColors .STRING , StandardColors .NUMBER );
@@ -351,7 +354,7 @@ public void deserializesUnionReferencingOtherUnion() {
351
354
352
355
assertThrows (
353
356
MalformedTypedAstException .class ,
354
- () -> ColorPool .fromOnlyShard (typePool , StringPool .empty ()));
357
+ () -> ColorPool .fromOnlyShardForTesting (typePool , StringPool .empty ()));
355
358
}
356
359
357
360
@ Test
@@ -381,8 +384,8 @@ public void deserializingUnionsInCycleThrowsErrors() {
381
384
assertThrows (
382
385
MalformedTypedAstException .class ,
383
386
() ->
384
- ColorPool .fromOnlyShard (typePool , StringPool .empty ())
385
- .getOnlyShard ()
387
+ ColorPool .fromOnlyShardForTesting (typePool , StringPool .empty ())
388
+ .getOnlyShardForTesting ()
386
389
.getColor (poolPointer (0 )));
387
390
}
388
391
@@ -393,8 +396,8 @@ public void throwsException_onTypeWithoutKindCase() {
393
396
assertThrows (
394
397
MalformedTypedAstException .class ,
395
398
() ->
396
- ColorPool .fromOnlyShard (typePool , StringPool .empty ())
397
- .getOnlyShard ()
399
+ ColorPool .fromOnlyShardForTesting (typePool , StringPool .empty ())
400
+ .getOnlyShardForTesting ()
398
401
.getColor (poolPointer (0 )));
399
402
}
400
403
@@ -412,8 +415,8 @@ public void throwsException_onSerializedUnionOfSingleElement() {
412
415
assertThrows (
413
416
MalformedTypedAstException .class ,
414
417
() ->
415
- ColorPool .fromOnlyShard (typePool , StringPool .empty ())
416
- .getOnlyShard ()
418
+ ColorPool .fromOnlyShardForTesting (typePool , StringPool .empty ())
419
+ .getOnlyShardForTesting ()
417
420
.getColor (poolPointer (0 )));
418
421
}
419
422
@@ -430,7 +433,7 @@ public void throwsException_onOutOfBoundsStringPoolOffset() {
430
433
.build ();
431
434
assertThrows (
432
435
IndexOutOfBoundsException .class ,
433
- () -> ColorPool .fromOnlyShard (typePool , StringPool .empty ()));
436
+ () -> ColorPool .fromOnlyShardForTesting (typePool , StringPool .empty ()));
434
437
}
435
438
436
439
@ Test
@@ -479,7 +482,7 @@ public void throwsException_onDuplicateIdsInSinglePool() {
479
482
// When & Then
480
483
assertThrows (
481
484
MalformedTypedAstException .class ,
482
- () -> ColorPool .fromOnlyShard (typePool , StringPool .empty ()));
485
+ () -> ColorPool .fromOnlyShardForTesting (typePool , StringPool .empty ()));
483
486
}
484
487
485
488
@ Test
0 commit comments