public void testPageBuckets() {
final String uidString = "16s2o7s01001d9vj";
{
// LoggedIn + MX maps to [0, 0.5, 0.5] ranges
final Identifiers identifiers = new Identifiers(TestType.PAGE, uidString);
final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ true , /* country */ "FR", /* account */ new Account(10));
assertEquals("pimple:test1", calcBuckets(result));
// Check and make sure UnitTestGroups respects these groups and works as expected.
final UnitTestGroups grps = new UnitTestGroups(result);
assertEquals(UnitTestGroups.Pimple.TEST, grps.getPimple());
assertEquals(1, grps.getPimpleValue(-99));
assertNotNull(grps.getKluj());
assertEquals(-99, grps.getKlujValue(-99));
assertNotNull(grps.getOop_poop());
assertEquals(-99, grps.getOop_poopValue(-99));
// Check the boolean conditions for one of the tests
assertFalse(grps.isPimpleInactive());
assertFalse(grps.isPimpleControl());
assertTrue(grps.isPimpleTest());
assertEquals("pimple1", grps.toString());
}
{
// LoggedIn + US maps to [1, 0, 0] range
final Identifiers identifiers = new Identifiers(TestType.PAGE, uidString);
final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ true , /* country */ "US", /* account */ new Account(10));
assertEquals("pimple:inactive-1", calcBuckets(result));
// Check and make sure UnitTestGroups respects these groups and works as expected.
final UnitTestGroups grps = new UnitTestGroups(result);
assertEquals(UnitTestGroups.Pimple.INACTIVE, grps.getPimple());
assertEquals(-1, grps.getPimpleValue(-99));
assertNotNull(grps.getKluj());
assertEquals(-99, grps.getKlujValue(-99));
assertNotNull(grps.getOop_poop());
assertEquals(-99, grps.getOop_poopValue(-99));
// Check the boolean conditions for one of the tests
assertTrue(grps.isPimpleInactive());
assertFalse(grps.isPimpleControl());
assertFalse(grps.isPimpleTest());
assertEquals("", grps.toString());
}
{
// LoggedIn=false + MX maps to [1, 0, 0] range
final Identifiers identifiers = new Identifiers(TestType.PAGE, uidString);
final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ false , /* country */ "FR", /* account */ new Account(10));
assertEquals("", calcBuckets(result));
// Check and make sure UnitTestGroups respects these groups and works as expected.
final UnitTestGroups grps = new UnitTestGroups(result);
assertNotNull(grps.getPimple());
assertEquals(-99, grps.getPimpleValue(-99));