if        (lv.member().equals(m0)) { Assert.assertTrue( "m0 -> gc via == gA", lv.via().equals(gA) ); Assert.assertTrue("gC eff == m0", true); if        (lv.chain().size() == 2) { Assert.assertTrue("m0 -> gC chain == 2", true); } else if (lv.chain().size() == 5) { Assert.assertTrue("m0 -> gC chain == 5", true); } else { Assert.fail("m0 -> gC chain != (2,5)"); } } else if (lv.member().equals(gA.toMember())) { Assert.assertTrue("gC eff == gA", true); Assert.assertTrue( "gA -> gC via == gB", lv.via().equals(gB) ); if        (lv.chain().size() == 1) { Assert.assertTrue("gA -> gC chain == 1", true); } else if (lv.chain().size() == 4) { Assert.assertTrue("gA -> gC chain == 4", true); } else { Assert.fail("gA -> gC chain != (1,4)"); } } else if (lv.member().equals(gB.toMember())) { Assert.assertTrue("gC eff == gB", true); Assert.assertTrue( "gB -> gC via == gC", lv.via().equals(gC) ); Assert.assertTrue( "gB -> gC chain == 3", lv.chain().size() == 3 ); MemberVia mv0 = (MemberVia) lv.chain().get(0); Assert.assertTrue( "gB -> gC via[0] g == gA", mv0.toList(s).group().equals(gA) ); Assert.assertTrue( "gB -> gC via[0] m == gC", mv0.toList(s).member().equals(gC.toMember()) ); MemberVia mv1 = (MemberVia) lv.chain().get(1); Assert.assertTrue( "gB -> gC via[1] g == gB", mv1.toList(s).group().equals(gB) ); Assert.assertTrue( "gB -> gC via[1] m == gA", mv1.toList(s).member().equals(gA.toMember()) ); MemberVia mv2 = (MemberVia) lv.chain().get(2); Assert.assertTrue( "gB -> gC via[2] g == gC", mv2.toList(s).group().equals(gC) ); Assert.assertTrue( "gB -> gC via[2] m == gB", mv2.toList(s).member().equals(gB.toMember()) ); } else if (lv.member().equals(gC.toMember())) { Assert.assertTrue("gC eff == gC", true); Assert.assertTrue( "gC -> gC via == gA", lv.via().equals(gA) ); Assert.assertTrue( "gC -> gC chain == 2", lv.chain().size() == 2 ); } else { Assert.fail("gC eff != (m0, gA, gB, gC)"); }
  public void testMoF() {    Subject subj = GrouperSubject.load(Constants.rootI, Constants.rootT);    GrouperSession s = GrouperSession.start(subj);    // Create ns0    GrouperStem ns0 = GrouperStem.create(                         s, Constants.ns0s, Constants.ns0e                       );    // Create gA    GrouperGroup gA  = GrouperGroup.create(                         s, Constants.gAs, Constants.gAe                       );    // Create gB    GrouperGroup gB  = GrouperGroup.create(                         s, Constants.gBs, Constants.gBe                       );    // Create gC    GrouperGroup gC  = GrouperGroup.create(                         s, Constants.gCs, Constants.gCe                       );    // Load m0    GrouperMember m0 = GrouperMember.load(                         s, Constants.mem0I, Constants.mem0T                       );    // Add m0 to gA's "members"    try {      gA.listAddVal(m0);    } catch (RuntimeException e) {      Assert.fail("add m0 to gA");    }    // Add gA to gB's "members"    try {      gB.listAddVal(gA.toMember());    } catch (RuntimeException e) {      Assert.fail("add gA to gB");    }    // Add gB to gC's "members"    try {      gC.listAddVal(gB.toMember());    } catch (RuntimeException e) {      Assert.fail("add gB to gC");    }    // Add gC to gA's "members"    try {      gA.listAddVal(gC.toMember());    } catch (RuntimeException e) {      Assert.fail("add gC to gA");    }    // Now inspect gA's, resulting list values    Assert.assertTrue(      "gA members == 5", gA.listVals("members").size() == 5    );    Assert.assertTrue(      "gA imm members == 2", gA.listImmVals("members").size() == 2    );    Assert.assertTrue(      "gA eff members == 3", gA.listEffVals("members").size() == 3    );    Iterator iterAI = gA.listImmVals("members").iterator();    while (iterAI.hasNext()) {      GrouperList lv = (GrouperList) iterAI.next();      Assert.assertTrue("gA empty chain", lv.chain().size() == 0);      Assert.assertNull("gA null via", lv.via());    }    Iterator iterAE = gA.listEffVals("members").iterator();    while (iterAE.hasNext()) {      GrouperList lv = (GrouperList) iterAE.next();      Assert.assertTrue("gA !empty chain", lv.chain().size() > 0);      Assert.assertNotNull("gA !null via", lv.via());    }    // Now inspect gB's, resulting list values    Assert.assertTrue(      "gB members == 6", gB.listVals("members").size() == 6    );    Assert.assertTrue(      "gB imm members == 1", gB.listImmVals("members").size() == 1    );    Assert.assertTrue(      "gB eff members == 5", gB.listEffVals("members").size() == 5    );    Iterator iterBI = gB.listImmVals("members").iterator();    while (iterBI.hasNext()) {      GrouperList lv = (GrouperList) iterBI.next();      Assert.assertTrue("gB empty chain", lv.chain().size() == 0);      Assert.assertNull("gB null via", lv.via());    }    Iterator iterBE = gB.listEffVals("members").iterator();    while (iterBE.hasNext()) {      GrouperList lv = (GrouperList) iterBE.next();      Assert.assertTrue("gB !empty chain", lv.chain().size() > 0);      Assert.assertNotNull("gB !null via", lv.via());    }    // Now inspect gC's, resulting list values    Assert.assertTrue(      "gC members == 7", gC.listVals("members").size() == 7    );    Assert.assertTrue(      "gC imm members == 1", gC.listImmVals("members").size() == 1    );    Assert.assertTrue(      "gC eff members == 6", gC.listEffVals("members").size() == 6    );    Iterator iterCI = gC.listImmVals("members").iterator();    while (iterCI.hasNext()) {      GrouperList lv = (GrouperList) iterCI.next();      Assert.assertTrue("gC empty chain", lv.chain().size() == 0);      Assert.assertNull("gC null via", lv.via());    }    Iterator iterCE = gC.listEffVals("members").iterator();    while (iterCE.hasNext()) {      GrouperList lv = (GrouperList) iterCE.next();      Assert.assertTrue("gC !empty chain", lv.chain().size() > 0);      Assert.assertNotNull("gC !null via", lv.via());    }    s.stop();  }