Skip to content

Commit

Permalink
tons of tests: removed TEST_NAME from when/then or completely
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Mar 2, 2020
1 parent d1e94a3 commit a45fb2e
Show file tree
Hide file tree
Showing 131 changed files with 3,363 additions and 3,616 deletions.
Expand Up @@ -28,7 +28,6 @@
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.test.IntegrationTestTools;
import com.evolveum.midpoint.test.util.TestUtil;
import com.evolveum.midpoint.util.exception.*;
import com.evolveum.midpoint.web.AbstractInitializedGuiIntegrationTest;
import com.evolveum.midpoint.web.AdminGuiTestConstants;
Expand Down Expand Up @@ -123,7 +122,6 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti

PrismObject<SystemConfigurationType> systemConfig = parseObject(SYSTEM_CONFIGURATION_FILE);

// LOGGER.info("adding system config page");
addObject(systemConfig, ModelExecuteOptions.createOverwrite(), initTask, initResult);

}
Expand All @@ -136,7 +134,7 @@ public void test100CreateWrapperUserJack() throws Exception {
OperationResult result = task.getResult();

// WHEN
when(TEST_NAME);
when();
assertLoggedInUserOid(USER_ADMINISTRATOR_OID);

PrismObject<UserType> user = getUser(USER_JACK_OID);
Expand All @@ -147,7 +145,7 @@ public void test100CreateWrapperUserJack() throws Exception {
PrismObjectWrapper<UserType> objectWrapper = factory.createObjectWrapper(user, ItemStatus.NOT_CHANGED, context);

// THEN
then(TEST_NAME);
then();

IntegrationTestTools.display("Wrapper after", objectWrapper);

Expand Down Expand Up @@ -220,7 +218,7 @@ public void test110CreateWrapperUserNewEmpty() throws Exception {
PrismObject<UserType> user = getUserDefinition().instantiate();

// WHEN
when(TEST_NAME);
when();

Task task = taskManager.createTaskInstance(TEST_NAME);
OperationResult result = task.getResult();
Expand All @@ -233,7 +231,7 @@ public void test110CreateWrapperUserNewEmpty() throws Exception {
PrismObjectWrapper<UserType> objectWrapper = factory.createObjectWrapper(user, ItemStatus.ADDED, context);

// THEN
then(TEST_NAME);
then();

IntegrationTestTools.display("Wrapper after", objectWrapper);

Expand Down Expand Up @@ -290,7 +288,7 @@ public void test112CreateWrapperUserNewman() throws Exception {
PrismObject<UserType> user = getUserDefinition().instantiate();

// WHEN
when(TEST_NAME);
when();

Task task = taskManager.createTaskInstance(TEST_NAME);
OperationResult result = task.getResult();
Expand All @@ -310,7 +308,7 @@ public void test112CreateWrapperUserNewman() throws Exception {
WrapperTestUtil.fillInPropertyWrapper(modelServiceLocator, mainContainerValueWrapper, extensionPath(PIRACY_SHIP), USER_NEWMAN_SHIP);

// THEN
then(TEST_NAME);
then();

IntegrationTestTools.display("Wrapper after", objectWrapper);

Expand Down Expand Up @@ -368,7 +366,7 @@ public void test102CreateWrapperUserEmpty() throws Exception {
PrismObject<UserType> userOld = user.clone();

// WHEN
when(TEST_NAME);
when();

Task task = taskManager.createTaskInstance(TEST_NAME);
OperationResult result = task.getResult();
Expand All @@ -380,7 +378,7 @@ public void test102CreateWrapperUserEmpty() throws Exception {
PrismObjectWrapper<UserType> objectWrapper = factory.createObjectWrapper(user, ItemStatus.NOT_CHANGED, context);

// THEN
then(TEST_NAME);
then();

IntegrationTestTools.display("Wrapper after", objectWrapper);

Expand Down Expand Up @@ -430,7 +428,7 @@ public void test150CreateWrapperShadow() throws Exception {
PrismObject<ShadowType> shadowOld = shadow.clone();

// WHEN
when(TEST_NAME);
when();
Task task = taskManager.createTaskInstance(TEST_NAME);
OperationResult result = task.getResult();

Expand All @@ -445,7 +443,7 @@ public void test150CreateWrapperShadow() throws Exception {


// THEN
then(TEST_NAME);
then();
display("Wrapper after", objectWrapper);

WrapperTestUtil.assertWrapper(objectWrapper, getString("prismContainer.mainPanelDisplayName"), "shadow description", shadow, shadowOld, ItemStatus.NOT_CHANGED);
Expand Down Expand Up @@ -596,14 +594,14 @@ public void test220AssignRoleLandluberToWally() throws Exception {
assertGroupMember(dummyGroup, USER_WALLY_NAME);

// WHEN
when(TEST_NAME);
when();

PrismObjectWrapper<ShadowType> objectWrapper = createObjectWrapper(task, shadow, ItemStatus.NOT_CHANGED);
assertTrue("Wrong wrapper created. Expected ShadowWrapper but was " + objectWrapper.getClass().getSimpleName(), objectWrapper instanceof ShadowWrapper);
ShadowWrapper shadowWrapper = (ShadowWrapper) objectWrapper;

// THEN
then(TEST_NAME);
then();

display("Wrapper after", shadowWrapper);

Expand Down Expand Up @@ -705,11 +703,11 @@ public void test241OrgScummBarModifyTransformProperties() throws Exception {
IntegrationTestTools.display("Wrapper after", objectWrapper);

// WHEN
when(TEST_NAME);
when();
ObjectDelta<OrgType> objectDelta = objectWrapper.getObjectDelta();

// THEN
then(TEST_NAME);
then();
display("Delta", objectDelta);
ItemPath ahoyPath = ItemPath.create(ObjectType.F_EXTENSION, PIRACY_TRANSFORM, valueWrapperA.getNewValue().getId(), PIRACY_REPLACEMENT);
PrismAsserts.assertPropertyReplace(objectDelta, ahoyPath, "Ahoy");
Expand Down Expand Up @@ -752,11 +750,11 @@ public void test242OrgScummBarAddTransform() throws Exception {
IntegrationTestTools.display("Wrapper after", objectWrapper);

// WHEN
when(TEST_NAME);
when();
ObjectDelta<OrgType> objectDelta = objectWrapper.getObjectDelta();

// THEN
then(TEST_NAME);
then();
display("Delta", objectDelta);
ItemPath transformPath = ItemPath.create(ObjectType.F_EXTENSION, PIRACY_TRANSFORM);
PrismAsserts.assertModifications(objectDelta, 1);
Expand Down Expand Up @@ -804,11 +802,11 @@ public void test250OrgMinistryOrRumModifyTransformDescription() throws Exception
IntegrationTestTools.display("Wrapper after", objectWrapper);

// WHEN
when(TEST_NAME);
when();
ObjectDelta<OrgType> objectDelta = objectWrapper.getObjectDelta();

// THEN
then(TEST_NAME);
then();
display("Delta", objectDelta);
PrismAsserts.assertModifications(objectDelta, 1);

Expand Down Expand Up @@ -882,12 +880,12 @@ public void test800EditSchemaJackPropReadAllModifySomeUser() throws Exception {
display("user before", user);

// WHEN
when(TEST_NAME);
when();

PrismObjectWrapper<UserType> objectWrapper = createObjectWrapper(getTestTask(), user, ItemStatus.NOT_CHANGED);

// THEN
then(TEST_NAME);
then();

IntegrationTestTools.display("Wrapper after", objectWrapper);
assertEquals("Wrong object wrapper readOnly", Boolean.FALSE, (Boolean)objectWrapper.isReadOnly());
Expand Down Expand Up @@ -954,12 +952,12 @@ public void test802EditSchemaJackPropReadSomeModifySomeUser() throws Exception {
display("user before", user);

// WHEN
when(TEST_NAME);
when();

PrismObjectWrapper<UserType> objectWrapper = createObjectWrapper(task, user, ItemStatus.NOT_CHANGED);

// THEN
then(TEST_NAME);
then();

IntegrationTestTools.display("Wrapper after", objectWrapper);
assertEquals("Wrong object wrapper readOnly", Boolean.FALSE, (Boolean)objectWrapper.isReadOnly());
Expand Down
Expand Up @@ -101,7 +101,7 @@ public void test100DecideNoRole() throws Exception {
Authentication authentication = createPasswordAuthentication(USER_JACK_USERNAME, UserType.class);

// WHEN
when(TEST_NAME);
when();

assertAllow(authentication, "/login");
assertAllow(authentication, "/");
Expand All @@ -112,7 +112,7 @@ public void test100DecideNoRole() throws Exception {
assertDeny(authentication, "/admin/config/debugs");

// THEN
then(TEST_NAME);
then();
}

@Test
Expand All @@ -128,7 +128,7 @@ public void test110DecideRoleUiAllowAll() throws Exception {
Authentication authentication = createPasswordAuthentication(USER_JACK_USERNAME, UserType.class);

// WHEN
when(TEST_NAME);
when();

assertAllow(authentication, "/login");
assertAllow(authentication, "/");
Expand All @@ -139,7 +139,7 @@ public void test110DecideRoleUiAllowAll() throws Exception {
assertAllow(authentication, "/admin/config/debugs");

// THEN
then(TEST_NAME);
then();
}

@Test
Expand All @@ -155,7 +155,7 @@ public void test120DecideRoleUiDenyAll() throws Exception {
Authentication authentication = createPasswordAuthentication(USER_JACK_USERNAME, UserType.class);

// WHEN
when(TEST_NAME);
when();

assertAllow(authentication, "/login");
assertAllow(authentication, "/");
Expand All @@ -166,7 +166,7 @@ public void test120DecideRoleUiDenyAll() throws Exception {
assertDeny(authentication, "/admin/config/debugs");

// THEN
then(TEST_NAME);
then();

}

Expand All @@ -186,7 +186,7 @@ public void test200DecideRoleUiDenyAllow() throws Exception {
Authentication authentication = createPasswordAuthentication(USER_JACK_USERNAME, UserType.class);

// WHEN
when(TEST_NAME);
when();

assertAllow(authentication, "/login");
assertAllow(authentication, "/");
Expand All @@ -197,7 +197,7 @@ public void test200DecideRoleUiDenyAllow() throws Exception {
assertDeny(authentication, "/admin/config/debugs");

// THEN
then(TEST_NAME);
then();

}

Expand All @@ -220,7 +220,7 @@ public void test300ConflictingAuthorizationIds() throws Exception {
login(USER_JACK_USERNAME);

// THEN
then(TEST_NAME);
then();
assertLoggedInUsername(USER_JACK_USERNAME);
}

Expand Down

0 comments on commit a45fb2e

Please sign in to comment.