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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assertContains
(String outer, String inner) void
assertContains
(String message, String outer, String inner) void
assertContainsAttributeDef
(Collection<AttributeDef> attributeDefs, AttributeDef attributeDef, String message) void
assertContainsAttributeDefName
(Collection<AttributeDefName> attributeDefNames, AttributeDefName attributeDefName, String message) void
assertContainsGroup
(Collection<Group> groups, Group group, String message) void
assertContainsGroups
(Collection<Group> expectedGroups, Collection<Group> actualGroups, String message) void
assertContainsStem
(Collection<Stem> stems, Stem stem, String message) void
assertContainsStems
(Collection<Stem> expectedStems, Collection<Stem> actualStems, String message) void
assertContainsString
(Collection<String> strings, String string) void
assertContainsString
(Collection<String> strings, String string, String message) void
assertDoNotFindGroupByAttribute
(GrouperSession s, String attr, String val) void
void
assertDoNotFindGroupByName
(GrouperSession s, String name, String msg) void
void
assertDoNotFindGroupByType
(GrouperSession s, GroupType type, String msg) void
void
assertDoNotFindStemByName
(GrouperSession s, String name, String msg) static void
assertEquals
(Subject expected, Subject actual) Asserts that two subjects are equal.static void
assertEquals
(String message, Subject expected, Subject actual) Asserts that two subjects are equal.static void
Asserts that two subjects are equal.static void
assertEqualsMultiKey
(Set<MultiKey> expected, Set<MultiKey> actual) Asserts that two subjects are equal.static void
Asserts that two subjects are equal.static void
assertEqualsObjectArrays
(Set<Object[]> expected, Set<Object[]> actual) Asserts that two object arrays are equal.assertFindField
(String name) assertFindGroupByAttribute
(GrouperSession s, String attr, String val) assertFindGroupByName
(GrouperSession s, String name) assertFindGroupByName
(GrouperSession s, String name, String msg) assertFindGroupByType
(GrouperSession s, GroupType type) assertFindGroupByType
(GrouperSession s, GroupType type, String msg) assertFindGroupType
(String name) assertFindStemByName
(GrouperSession s, String name) assertFindStemByName
(GrouperSession s, String name, String msg) void
assertGroupAttribute
(Group g, String attr, String exp) void
assertGroupCreateSubject
(Group g, Subject subj) void
assertGroupCreateTime
(Group g, Date d) void
assertGroupDescription
(Group g, String val) void
assertGroupDisplayExtension
(Group g, String val) void
assertGroupDisplayName
(Group g, String val) void
assertGroupExtension
(Group g, String val) void
assertGroupHasAdmin
(Group g, Subject subj, boolean exp) void
assertGroupHasGroupAttrRead
(Group g, Subject subj, boolean exp) void
assertGroupHasGroupAttrUpdate
(Group g, Subject subj, boolean exp) void
assertGroupHasMember
(Group g, Subject subj, boolean exp) void
assertGroupHasMember
(Group g, Subject subj, Field f, boolean exp) void
assertGroupHasOptin
(Group g, Subject subj, boolean exp) void
assertGroupHasOptout
(Group g, Subject subj, boolean exp) void
assertGroupHasRead
(Group g, Subject subj, boolean exp) void
assertGroupHasType
(Group g, GroupType type, boolean exp) void
assertGroupHasUpdate
(Group g, Subject subj, boolean exp) void
assertGroupHasView
(Group g, Subject subj, boolean exp) void
assertGroupName
(Group g, String val) void
assertGroupSetsAndOrder
(Set<Group> set1, Set<Group> set2) make sure a set of groups is similar to another by group name including ordervoid
assertGroupUuid
(Group g, String val) void
assertHasPrivilege
(Set<Object[]> results, AttributeDef attributeDef, Subject subject, Privilege privilege) make sure a result set has a privilege from a user and attribute defvoid
make sure a result set has a privilege from a user and stemvoid
make sure a result set has a privilege from a user and stemvoid
assertNotContainsAttributeDef
(Collection<AttributeDef> attributeDefs, AttributeDef attributeDef, String message) void
assertNotContainsAttributeDefName
(Collection<AttributeDefName> attributeDefNames, AttributeDefName attributeDefName, String message) void
assertNotContainsGroup
(Collection<Group> groups, Group group, String message) void
assertNotContainsStem
(Collection<Stem> stems, Stem stem, String message) void
assertStemCreateSubject
(Stem ns, Subject subj) void
assertStemCreateTime
(Stem ns, Date d) void
assertStemDescription
(Stem ns, String val) void
assertStemDisplayExtension
(Stem ns, String val) void
assertStemDisplayName
(Stem ns, String val) void
assertStemExtension
(Stem ns, String val) void
assertStemHasCreate
(Stem ns, Subject subj, boolean exp) void
assertStemHasStem
(Stem ns, Subject subj, boolean exp) void
assertStemName
(Stem ns, String val) void
assertStemUuid
(Stem ns, String val) static void
deleteGroupIfExists
(GrouperSession grouperSession, String name) helper method to delete group if existstatic void
deleteStemIfExists
(GrouperSession grouperSession, String name) helper method to delete stem if existfilterOutBuiltInGroups
(Set<Group> groups) static String
groupsString
(Collection<Group> groups) void
printMemberships
(Set<Object[]> results) print out memberships to help with debuggingstatic String
stemsString
(Collection<Stem> stems) void
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
-
Field Details
-
G
- See Also:
-
NS
- See Also:
-
-
Constructor Details
-
GrouperTestBase
public GrouperTestBase() -
GrouperTestBase
-
-
Method Details
-
assertEqualsObjectArrays
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
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
Asserts that two subjects are equal. If they are not an AssertionFailedError is thrown with the given message. -
assertEquals
Asserts that two subjects are equal. If they are not an AssertionFailedError is thrown with the given message. -
assertContains
- Parameters:
message
-outer
-inner
-
-
assertContainsGroup
- Parameters:
message
-groups
-group
-
-
assertContainsString
- Type Parameters:
T
-- Parameters:
strings
-string
-
-
assertContainsString
- 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
- Parameters:
groups
-- Returns:
- the groups string
-
stemsString
- Parameters:
stems
-- Returns:
- the stems string
-
assertContainsStem
- Parameters:
message
-stems
-stem
-
-
assertNotContainsStem
- Parameters:
message
-stems
-stem
-
-
assertNotContainsGroup
- 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
- Parameters:
message
-outer
-inner
-
-
assertDoNotFindGroupByAttribute
- Since:
- 1.1.0
-
assertDoNotFindGroupByName
- Since:
- 1.1.0
-
assertDoNotFindGroupByName
- Since:
- 1.1.0
-
assertDoNotFindGroupByType
- Since:
- 1.2.0
-
assertDoNotFindGroupByType
- Since:
- 1.2.0
-
assertDoNotFindStemByName
- Since:
- 1.1.0
-
assertDoNotFindStemByName
- Since:
- 1.1.0
-
assertFindField
- Since:
- 1.1.0
-
assertFindGroupByAttribute
- Returns:
- Retrieved
Group
. - Since:
- 1.1.0
-
assertFindGroupByName
- Returns:
- Retrieved
Group
. - Since:
- 1.1.0
-
assertFindGroupByName
- Returns:
- Retrieved
Group
. - Since:
- 1.1.0
-
assertFindGroupByType
- Since:
- 1.2.0
-
assertFindGroupByType
- Since:
- 1.2.0
-
assertFindGroupType
- Since:
- 1.1.0
-
assertFindStemByName
- Returns:
- Retrieved
Stem
. - Since:
- 1.1.0
-
assertFindStemByName
- Since:
- 1.1.0
-
assertGroupAttribute
- Since:
- 1.1.0
-
assertGroupCreateSubject
- Since:
- 1.1.0
-
assertGroupCreateTime
- Since:
- 1.1.0
-
assertGroupDescription
- Since:
- 1.1.0
-
assertGroupDisplayExtension
- Since:
- 1.1.0
-
assertGroupDisplayName
- Since:
- 1.1.0
-
assertGroupExtension
- Since:
- 1.1.0
-
assertGroupHasAdmin
- Since:
- 1.1.0
-
assertGroupHasMember
- Since:
- 1.1.0
-
assertGroupHasMember
- Since:
- 1.1.0
-
assertGroupHasOptin
- Since:
- 1.1.0
-
assertGroupHasOptout
- Since:
- 1.1.0
-
assertGroupHasRead
- Since:
- 1.1.0
-
assertGroupHasGroupAttrRead
- Parameters:
g
-subj
-exp
-
-
assertGroupHasGroupAttrUpdate
- Parameters:
g
-subj
-exp
-
-
assertGroupHasType
- Since:
- 1.1.0
-
assertGroupHasUpdate
- Since:
- 1.1.0
-
assertGroupHasView
- Since:
- 1.1.0
-
assertGroupName
- Since:
- 1.1.0
-
assertGroupUuid
- Since:
- 1.1.0
-
assertStemCreateSubject
- Since:
- 1.1.0
-
assertStemCreateTime
- Since:
- 1.1.0
-
assertStemDescription
- Since:
- 1.1.0
-
assertStemDisplayExtension
- Since:
- 1.1.0
-
assertStemDisplayName
- Since:
- 1.1.0
-
assertStemExtension
- Since:
- 1.1.0
-
assertStemHasCreate
- Since:
- 1.1.0
-
assertStemHasStem
- Since:
- 1.1.0
-
assertStemName
- Since:
- 1.1.0
-
assertStemUuid
- Since:
- 1.1.0
-
unexpectedException
- 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, memberstemA
-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, memberattributeDef
-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, memberstemA
-subject
-privilege
-
-
printMemberships
print out memberships to help with debugging- Parameters:
memberships
-
-
assertGroupSetsAndOrder
make sure a set of groups is similar to another by group name including order- Parameters:
set1
- expected setset2
- received set
-
filterOutBuiltInGroups
- Parameters:
groups
-- Returns:
- the filtered groups
-
deleteGroupIfExists
helper method to delete group if exist- Parameters:
grouperSession
-name
-- Throws:
Exception
-
deleteStemIfExists
helper method to delete stem if exist- Parameters:
grouperSession
-name
-- Throws:
Exception
-