PolicyTrie { static Iterator<JsonKey> getJsonKeyIterator(final ResourceKey resourceKey) { checkNotNull(resourceKey, "resource key to convert"); return JsonFactory.newPointer(resourceKey.getResourceType()).append(resourceKey.getResourcePath()).iterator(); } private  PolicyTrie(); private  PolicyTrie(final GrantRevokeIndex grantRevokeIndex, final Map<JsonKey, PolicyTrie> children);   }
@Test public void getJsonKeyIteratorReturnsExpected() { final JsonPointer barResourcePath = barResourceKey.getResourcePath(); final Collection<JsonKey> expectedJsonKeys = new ArrayList<>(1 + barResourcePath.getLevelCount()); expectedJsonKeys.add(JsonFactory.newKey(barResourceKey.getResourceType())); barResourcePath.forEach(expectedJsonKeys::add); final Iterator<JsonKey> jsonKeyIterator = PolicyTrie.getJsonKeyIterator(barResourceKey); assertThat(jsonKeyIterator).toIterable().containsExactlyElementsOf(expectedJsonKeys); }