### Question:
RepositoryContext { public EntityKey buildEntityKeyForGroup(String externalGroupId) { return new EntityKey() .setId(GroupIdEncoder.encodeGroupId(externalGroupId)) .setNamespace(getIdentitySourceConfiguration().getGroupNamespace()); } private  RepositoryContext(Builder builder); ImmutableMap<String, IdentitySourceConfiguration> getReferenceIdentitySourceConfiguration(); IdentitySourceConfiguration getIdentitySourceConfiguration(); Optional<RepositoryContext> getRepositoryContextForReferenceIdentitySource(
      String referenceSourceName); IdentityUser buildIdentityUser(String googleId, String externalId); IdentityGroup buildIdentityGroup(
      String externalGroupId, Supplier<Set<Membership>> members); EntityKey buildEntityKeyForGroup(String externalGroupId); static RepositoryContext fromConfiguration(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void testBuildGroupKey() { IdentitySourceConfiguration sourceConfiguration = new IdentitySourceConfiguration.Builder("idsource1") .setIdentitySourceSchema("idsource1") .setIdentitySourceSchemaAttribute("idsource1_identifier") .build(); RepositoryContext context = new RepositoryContext.Builder().setIdentitySourceConfiguration(sourceConfiguration).build(); assertThat( context.buildEntityKeyForGroup("group1"), equalTo(new EntityKey().setId("group1").setNamespace("identitysources/idsource1"))); }
@Test public void testBuildGroupKeyWithEncoding() { IdentitySourceConfiguration sourceConfiguration = new IdentitySourceConfiguration.Builder("idsource1") .setIdentitySourceSchema("idsource1") .setIdentitySourceSchemaAttribute("idsource1_identifier") .build(); RepositoryContext context = new RepositoryContext.Builder().setIdentitySourceConfiguration(sourceConfiguration).build(); assertThat( context.buildEntityKeyForGroup("group 1"), equalTo(new EntityKey().setId("group%201").setNamespace("identitysources/idsource1"))); }