Example #1
0
 Options retainAll(Schema schema, MarkSet markSet) {
   if (map.isEmpty()) return this; // Nothing to prune.
   Options result = new Options(optionType, optionElements);
   Object mapOrNull = retainAll(schema, markSet, optionType, map);
   result.map =
       mapOrNull != null
           ? (ImmutableMap<ProtoMember, Object>) mapOrNull
           : ImmutableMap.<ProtoMember, Object>of();
   return result;
 }
Example #2
0
 @Test
 public void resolveFieldPathDoesntMatch() throws Exception {
   assertThat(Options.resolveFieldPath("a.b", set("c", "d"))).isNull();
 }
Example #3
0
 @Test
 public void resolveFieldPathMatchesOnlySegment() throws Exception {
   assertThat(asList(Options.resolveFieldPath("a", set("a", "b")))).containsExactly("a");
 }
Example #4
0
 @Test
 public void resolveFieldPathMatchesAllSegments() throws Exception {
   assertThat(asList(Options.resolveFieldPath("a.b.c.d", set("a.b.c.d", "z.b.c.d"))))
       .containsExactly("a.b.c.d");
 }
Example #5
0
 @Test
 public void resolveFieldPathMatchesFirstSegment() throws Exception {
   assertThat(asList(Options.resolveFieldPath("a.b.c.d", set("a", "z", "y"))))
       .containsExactly("a", "b", "c", "d");
 }