NameAnonymizer { public long anonymizeVariant(@NonNull String projectName, @Nullable String variantName) { if (variantName == null) { return NO_VARIANT_SPECIFIED; } try { return mProjects.get(projectName).mVariantIds.get(variantName); } catch (ExecutionException e) { return NO_VARIANT_SPECIFIED; } } NameAnonymizer(); long anonymizeProjectName(@NonNull String projectName); long anonymizeVariant(@NonNull String projectName, @Nullable String variantName);  }
@Test public void anonymizeVariant() { NameAnonymizer nameAnonymizer = new NameAnonymizer(); assertEquals(NO_VARIANT_SPECIFIED, nameAnonymizer.anonymizeVariant(":a", null)); assertNotEquals(NO_VARIANT_SPECIFIED, nameAnonymizer.anonymizeVariant(":a", "debug")); assertNotEquals(NO_VARIANT_SPECIFIED, nameAnonymizer.anonymizeVariant(":a", "release")); assertEquals(nameAnonymizer.anonymizeVariant(":a", "debug"), nameAnonymizer.anonymizeVariant(":a", "debug")); assertEquals(nameAnonymizer.anonymizeVariant(":a", "release"), nameAnonymizer.anonymizeVariant(":a", "release")); assertNotEquals(nameAnonymizer.anonymizeVariant(":a", "debug"), nameAnonymizer.anonymizeVariant(":a", "release")); }