Class GrouperTestBase

java.lang.Object
junit.framework.Assert
junit.framework.TestCase
edu.internet2.middleware.grouper.testing.GrouperTestBase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
GrouperTestInApi

public class GrouperTestBase extends junit.framework.TestCase
Grouper-specific JUnit assertions. Do not subclass this, only use GrouperTestInApi or GrouperTest (unit test) Note, this shouldnt do anything in constructor, setup, teardown, etc since can be used from a prod env

  • Field Details

  • Constructor Details

    • GrouperTestBase

      public GrouperTestBase()
    • GrouperTestBase

      public GrouperTestBase(String name)
  • Method Details

    • assertEqualsObjectArrays

      public static void assertEqualsObjectArrays(Set<Object[]> expected, Set<Object[]> actual)
      Asserts that two object arrays are equal. If they are not an AssertionFailedError is thrown with the given message.
    • assertEqualsObjectArrays

      public static void assertEqualsObjectArrays(String message, Set<Object[]> expected, Set<Object[]> actual)
      Asserts that two subjects are equal. If they are not an AssertionFailedError is thrown with the given message.
    • assertEqualsMultiKey

      public static void assertEqualsMultiKey(Set<MultiKey> expected, Set<MultiKey> actual)
      Asserts that two subjects are equal. If they are not an AssertionFailedError is thrown with the given message.
    • assertEqualsMultiKey

      public static void assertEqualsMultiKey(String message, Set<MultiKey> expected, Set<MultiKey> actual)
      Asserts that two subjects are equal. If they are not an AssertionFailedError is thrown with the given message.
    • assertEquals

      public static void assertEquals(Subject expected, Subject actual)
      Asserts that two subjects are equal. If they are not an AssertionFailedError is thrown with the given message.
    • assertEquals

      public static void assertEquals(String message, Subject expected, Subject actual)
      Asserts that two subjects are equal. If they are not an AssertionFailedError is thrown with the given message.
    • assertContains

      public void assertContains(String message, String outer, String inner)
      Parameters:
      message -
      outer -
      inner -
    • assertContainsGroup

      public void assertContainsGroup(Collection<Group> groups, Group group, String message)
      Parameters:
      message -
      groups -
      group -
    • assertContainsString

      public void assertContainsString(Collection<String> strings, String string)
      Type Parameters:
      T -
      Parameters:
      strings -
      string -
    • assertContainsString

      public void assertContainsString(Collection<String> strings, String string, String message)
      Parameters:
      message -
      strings -
      string -
    • assertContainsGroups

      public void assertContainsGroups(Collection<Group> expectedGroups, Collection<Group> actualGroups, String message)
      Parameters:
      groups -
      group -
    • assertContainsStems

      public void assertContainsStems(Collection<Stem> expectedStems, Collection<Stem> actualStems, String message)
      Parameters:
      message -
      groups -
      group -
    • groupsString

      public static String groupsString(Collection<Group> groups)
      Parameters:
      groups -
      Returns:
      the groups string
    • stemsString

      public static String stemsString(Collection<Stem> stems)
      Parameters:
      stems -
      Returns:
      the stems string
    • assertContainsStem

      public void assertContainsStem(Collection<Stem> stems, Stem stem, String message)
      Parameters:
      message -
      stems -
      stem -
    • assertNotContainsStem

      public void assertNotContainsStem(Collection<Stem> stems, Stem stem, String message)
      Parameters:
      message -
      stems -
      stem -
    • assertNotContainsGroup

      public void assertNotContainsGroup(Collection<Group> groups, Group group, String message)
      Parameters:
      message -
      groups -
      group -
    • assertNotContainsAttributeDef

      public void assertNotContainsAttributeDef(Collection<AttributeDef> attributeDefs, AttributeDef attributeDef, String message)
      Parameters:
      message -
      attributeDefs -
      attributeDef -
    • assertNotContainsAttributeDefName

      public void assertNotContainsAttributeDefName(Collection<AttributeDefName> attributeDefNames, AttributeDefName attributeDefName, String message)
      Parameters:
      message -
      attributeDefNames -
      attributeDefName -
    • assertContainsAttributeDef

      public void assertContainsAttributeDef(Collection<AttributeDef> attributeDefs, AttributeDef attributeDef, String message)
      Parameters:
      message -
      attributeDefs -
      attributeDef -
    • assertContainsAttributeDefName

      public void assertContainsAttributeDefName(Collection<AttributeDefName> attributeDefNames, AttributeDefName attributeDefName, String message)
      Parameters:
      message -
      attributeDefNames -
      attributeDefName -
    • assertContains

      public void assertContains(String outer, String inner)
      Parameters:
      message -
      outer -
      inner -
    • assertDoNotFindGroupByAttribute

      public void assertDoNotFindGroupByAttribute(GrouperSession s, String attr, String val)
      Since:
      1.1.0
    • assertDoNotFindGroupByName

      public void assertDoNotFindGroupByName(GrouperSession s, String name)
      Since:
      1.1.0
    • assertDoNotFindGroupByName

      public void assertDoNotFindGroupByName(GrouperSession s, String name, String msg)
      Since:
      1.1.0
    • assertDoNotFindGroupByType

      public void assertDoNotFindGroupByType(GrouperSession s, GroupType type)
      Since:
      1.2.0
    • assertDoNotFindGroupByType

      public void assertDoNotFindGroupByType(GrouperSession s, GroupType type, String msg)
      Since:
      1.2.0
    • assertDoNotFindStemByName

      public void assertDoNotFindStemByName(GrouperSession s, String name)
      Since:
      1.1.0
    • assertDoNotFindStemByName

      public void assertDoNotFindStemByName(GrouperSession s, String name, String msg)
      Since:
      1.1.0
    • assertFindField

      public Field assertFindField(String name)
      Since:
      1.1.0
    • assertFindGroupByAttribute

      public Group assertFindGroupByAttribute(GrouperSession s, String attr, String val)
      Returns:
      Retrieved Group.
      Since:
      1.1.0
    • assertFindGroupByName

      public Group assertFindGroupByName(GrouperSession s, String name)
      Returns:
      Retrieved Group.
      Since:
      1.1.0
    • assertFindGroupByName

      public Group assertFindGroupByName(GrouperSession s, String name, String msg)
      Returns:
      Retrieved Group.
      Since:
      1.1.0
    • assertFindGroupByType

      public Group assertFindGroupByType(GrouperSession s, GroupType type)
      Since:
      1.2.0
    • assertFindGroupByType

      public Group assertFindGroupByType(GrouperSession s, GroupType type, String msg)
      Since:
      1.2.0
    • assertFindGroupType

      public GroupType assertFindGroupType(String name)
      Since:
      1.1.0
    • assertFindStemByName

      public Stem assertFindStemByName(GrouperSession s, String name)
      Returns:
      Retrieved Stem.
      Since:
      1.1.0
    • assertFindStemByName

      public Stem assertFindStemByName(GrouperSession s, String name, String msg)
      Since:
      1.1.0
    • assertGroupAttribute

      public void assertGroupAttribute(Group g, String attr, String exp)
      Since:
      1.1.0
    • assertGroupCreateSubject

      public void assertGroupCreateSubject(Group g, Subject subj)
      Since:
      1.1.0
    • assertGroupCreateTime

      public void assertGroupCreateTime(Group g, Date d)
      Since:
      1.1.0
    • assertGroupDescription

      public void assertGroupDescription(Group g, String val)
      Since:
      1.1.0
    • assertGroupDisplayExtension

      public void assertGroupDisplayExtension(Group g, String val)
      Since:
      1.1.0
    • assertGroupDisplayName

      public void assertGroupDisplayName(Group g, String val)
      Since:
      1.1.0
    • assertGroupExtension

      public void assertGroupExtension(Group g, String val)
      Since:
      1.1.0
    • assertGroupHasAdmin

      public void assertGroupHasAdmin(Group g, Subject subj, boolean exp)
      Since:
      1.1.0
    • assertGroupHasMember

      public void assertGroupHasMember(Group g, Subject subj, boolean exp)
      Since:
      1.1.0
    • assertGroupHasMember

      public void assertGroupHasMember(Group g, Subject subj, Field f, boolean exp)
      Since:
      1.1.0
    • assertGroupHasOptin

      public void assertGroupHasOptin(Group g, Subject subj, boolean exp)
      Since:
      1.1.0
    • assertGroupHasOptout

      public void assertGroupHasOptout(Group g, Subject subj, boolean exp)
      Since:
      1.1.0
    • assertGroupHasRead

      public void assertGroupHasRead(Group g, Subject subj, boolean exp)
      Since:
      1.1.0
    • assertGroupHasGroupAttrRead

      public void assertGroupHasGroupAttrRead(Group g, Subject subj, boolean exp)
      Parameters:
      g -
      subj -
      exp -
    • assertGroupHasGroupAttrUpdate

      public void assertGroupHasGroupAttrUpdate(Group g, Subject subj, boolean exp)
      Parameters:
      g -
      subj -
      exp -
    • assertGroupHasType

      public void assertGroupHasType(Group g, GroupType type, boolean exp)
      Since:
      1.1.0
    • assertGroupHasUpdate

      public void assertGroupHasUpdate(Group g, Subject subj, boolean exp)
      Since:
      1.1.0
    • assertGroupHasView

      public void assertGroupHasView(Group g, Subject subj, boolean exp)
      Since:
      1.1.0
    • assertGroupName

      public void assertGroupName(Group g, String val)
      Since:
      1.1.0
    • assertGroupUuid

      public void assertGroupUuid(Group g, String val)
      Since:
      1.1.0
    • assertStemCreateSubject

      public void assertStemCreateSubject(Stem ns, Subject subj)
      Since:
      1.1.0
    • assertStemCreateTime

      public void assertStemCreateTime(Stem ns, Date d)
      Since:
      1.1.0
    • assertStemDescription

      public void assertStemDescription(Stem ns, String val)
      Since:
      1.1.0
    • assertStemDisplayExtension

      public void assertStemDisplayExtension(Stem ns, String val)
      Since:
      1.1.0
    • assertStemDisplayName

      public void assertStemDisplayName(Stem ns, String val)
      Since:
      1.1.0
    • assertStemExtension

      public void assertStemExtension(Stem ns, String val)
      Since:
      1.1.0
    • assertStemHasCreate

      public void assertStemHasCreate(Stem ns, Subject subj, boolean exp)
      Since:
      1.1.0
    • assertStemHasStem

      public void assertStemHasStem(Stem ns, Subject subj, boolean exp)
      Since:
      1.1.0
    • assertStemName

      public void assertStemName(Stem ns, String val)
      Since:
      1.1.0
    • assertStemUuid

      public void assertStemUuid(Stem ns, String val)
      Since:
      1.1.0
    • unexpectedException

      public void unexpectedException(Exception e)
      Since:
      1.2.0
    • assertHasPrivilege

      public void assertHasPrivilege(Set<Object[]> results, Stem stem, Subject subject, Privilege privilege)
      make sure a result set has a privilege from a user and stem
      Parameters:
      result - set of object arrays of membership, stem, member
      stemA -
      subject -
      privilege -
    • assertHasPrivilege

      public void assertHasPrivilege(Set<Object[]> results, AttributeDef attributeDef, Subject subject, Privilege privilege)
      make sure a result set has a privilege from a user and attribute def
      Parameters:
      result - set of object arrays of membership, attribute def, member
      attributeDef -
      subject -
      privilege -
    • assertHasPrivilege

      public void assertHasPrivilege(Set<Object[]> results, Group group, Subject subject, Privilege privilege)
      make sure a result set has a privilege from a user and stem
      Parameters:
      result - set of object arrays of membership, stem, member
      stemA -
      subject -
      privilege -
    • printMemberships

      public void printMemberships(Set<Object[]> results)
      print out memberships to help with debugging
      Parameters:
      memberships -
    • assertGroupSetsAndOrder

      public void assertGroupSetsAndOrder(Set<Group> set1, Set<Group> set2)
      make sure a set of groups is similar to another by group name including order
      Parameters:
      set1 - expected set
      set2 - received set
    • filterOutBuiltInGroups

      public static Set<Group> filterOutBuiltInGroups(Set<Group> groups)
      Parameters:
      groups -
      Returns:
      the filtered groups
    • deleteGroupIfExists

      public static void deleteGroupIfExists(GrouperSession grouperSession, String name) throws Exception
      helper method to delete group if exist
      Parameters:
      grouperSession -
      name -
      Throws:
      Exception
    • deleteStemIfExists

      public static void deleteStemIfExists(GrouperSession grouperSession, String name) throws Exception
      helper method to delete stem if exist
      Parameters:
      grouperSession -
      name -
      Throws:
      Exception