http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConfigurationITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConfigurationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConfigurationITCase.java index dabbc4c..e94e3d7 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConfigurationITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConfigurationITCase.java @@ -18,12 +18,12 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.io.InputStream; @@ -42,7 +42,7 @@ import org.apache.syncope.common.lib.types.ClientExceptionType; import org.apache.syncope.common.lib.types.EntityViolationType; import org.apache.syncope.common.lib.types.SchemaType; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ConfigurationITCase extends AbstractITCase { @@ -73,7 +73,7 @@ public class ConfigurationITCase extends AbstractITCase { AttrTO conf = new AttrTO.Builder().schema(testKey.getKey()).build(); try { configurationService.set(conf); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType()); } @@ -160,7 +160,7 @@ public class ConfigurationITCase extends AbstractITCase { try { createSchema(SchemaType.PLAIN, failing); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidPlainSchema, e.getType());
http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java index 5f01974..b526213 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java @@ -18,13 +18,14 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.io.InputStream; @@ -63,8 +64,8 @@ import org.apache.syncope.common.rest.api.service.ResourceService; import org.apache.syncope.fit.AbstractITCase; import org.identityconnectors.common.security.GuardedString; import org.identityconnectors.framework.common.objects.ObjectClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class ConnectorITCase extends AbstractITCase { @@ -76,7 +77,7 @@ public class ConnectorITCase extends AbstractITCase { private static String testJDBCURL; - @BeforeClass + @BeforeAll public static void setUpConnIdBundles() throws IOException { InputStream propStream = null; try { @@ -105,14 +106,16 @@ public class ConnectorITCase extends AbstractITCase { assertNotNull(testJDBCURL); } - @Test(expected = SyncopeClientException.class) + @Test public void createWithException() { - ConnInstanceTO connectorTO = new ConnInstanceTO(); + assertThrows(SyncopeClientException.class, () -> { + ConnInstanceTO connectorTO = new ConnInstanceTO(); - Response response = connectorService.create(connectorTO); - if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) { - throw (RuntimeException) clientFactory.getExceptionMapper().fromResponse(response); - } + Response response = connectorService.create(connectorTO); + if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) { + throw (RuntimeException) clientFactory.getExceptionMapper().fromResponse(response); + } + }); } @Test @@ -176,8 +179,8 @@ public class ConnectorITCase extends AbstractITCase { assertEquals(Integer.valueOf(15), actual.getConnRequestTimeout()); assertEquals(connectorTO.getCapabilities(), actual.getCapabilities()); assertNotNull(actual.getPoolConf()); - assertEquals(1534, actual.getPoolConf().getMaxObjects(), 0); - assertEquals(10, actual.getPoolConf().getMaxIdle(), 0); + assertEquals(1534, actual.getPoolConf().getMaxObjects().intValue()); + assertEquals(10, actual.getPoolConf().getMaxIdle().intValue()); Throwable t = null; @@ -196,7 +199,7 @@ public class ConnectorITCase extends AbstractITCase { assertNull(t); assertNotNull(actual); assertEquals(EnumSet.of(ConnectorCapability.CREATE), actual.getCapabilities()); - assertEquals(10, actual.getPoolConf().getMaxObjects(), 0); + assertEquals(10, actual.getPoolConf().getMaxObjects().intValue()); // check also for the deletion of the created object try { @@ -446,7 +449,7 @@ public class ConnectorITCase extends AbstractITCase { try { connectorService.check(connectorTO); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -528,7 +531,7 @@ public class ConnectorITCase extends AbstractITCase { // 2. attempt to read a connector with a different admin realm: fail try { pcs.read("88a7a819-dab5-46b4-9b90-0b9769eabdb8", null); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.DelegatedAdministration, e.getType()); } @@ -689,7 +692,7 @@ public class ConnectorITCase extends AbstractITCase { try { try { connectorService.check(connectorTO); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DerSchemaITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DerSchemaITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DerSchemaITCase.java index db8bdaa..69a5d48 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DerSchemaITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DerSchemaITCase.java @@ -18,11 +18,11 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.List; import javax.ws.rs.core.Response; @@ -33,7 +33,7 @@ import org.apache.syncope.common.lib.types.EntityViolationType; import org.apache.syncope.common.lib.types.SchemaType; import org.apache.syncope.common.rest.api.beans.SchemaQuery; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DerSchemaITCase extends AbstractITCase { @@ -75,7 +75,7 @@ public class DerSchemaITCase extends AbstractITCase { try { schemaService.read(SchemaType.DERIVED, "rderiveddata"); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } finally { @@ -112,7 +112,7 @@ public class DerSchemaITCase extends AbstractITCase { try { createSchema(SchemaType.DERIVED, actual); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(Response.Status.CONFLICT, e.getType().getResponseStatus()); assertEquals(ClientExceptionType.EntityExists, e.getType()); @@ -121,7 +121,7 @@ public class DerSchemaITCase extends AbstractITCase { actual.setKey(null); try { createSchema(SchemaType.DERIVED, actual); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(Response.Status.BAD_REQUEST, e.getType().getResponseStatus()); assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType()); @@ -136,7 +136,7 @@ public class DerSchemaITCase extends AbstractITCase { try { createSchema(SchemaType.DERIVED, schema); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidDerSchema, e.getType()); assertTrue(e.getElements().iterator().next().contains(EntityViolationType.InvalidKey.name())); http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DomainITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DomainITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DomainITCase.java index 5c635e5..a24d22e 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DomainITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DomainITCase.java @@ -18,10 +18,10 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; import java.security.AccessControlException; import java.util.List; @@ -31,7 +31,7 @@ import org.apache.syncope.common.lib.to.DomainTO; import org.apache.syncope.common.lib.types.CipherAlgorithm; import org.apache.syncope.common.lib.types.ClientExceptionType; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DomainITCase extends AbstractITCase { @@ -54,7 +54,7 @@ public class DomainITCase extends AbstractITCase { try { domainService.create(domain); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -107,7 +107,7 @@ public class DomainITCase extends AbstractITCase { try { domainService.read(two.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DynRealmITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DynRealmITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DynRealmITCase.java index c1348f8..1bf4a54 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DynRealmITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DynRealmITCase.java @@ -18,11 +18,11 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Response; @@ -48,7 +48,7 @@ import org.apache.syncope.common.rest.api.service.GroupService; import org.apache.syncope.common.rest.api.service.UserService; import org.apache.syncope.fit.AbstractITCase; import org.apache.syncope.fit.ElasticsearchDetector; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class DynRealmITCase extends AbstractITCase { @@ -63,7 +63,7 @@ public class DynRealmITCase extends AbstractITCase { // invalid key (starts with /) try { dynRealmService.create(dynRealm); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidDynRealm, e.getType()); } @@ -180,7 +180,7 @@ public class DynRealmITCase extends AbstractITCase { // this will fail because unassigning resource-ldap would result in removing the user from the dynamic realm try { delegatedUserService.update(userPatch); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.DelegatedAdministration, e.getType()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java index 0e6357f..9653c97 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ExceptionMapperITCase.java @@ -18,8 +18,8 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.io.InputStream; @@ -34,14 +34,14 @@ import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.common.lib.types.AttrSchemaType; import org.apache.syncope.common.lib.types.SchemaType; import org.apache.syncope.fit.AbstractITCase; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class ExceptionMapperITCase extends AbstractITCase { private static final Properties ERROR_MESSAGES = new Properties(); - @BeforeClass + @BeforeAll public static void setUpErrorMessages() throws IOException { InputStream propStream = null; try { @@ -99,7 +99,7 @@ public class ExceptionMapperITCase extends AbstractITCase { try { createUser(userTO2); - fail(); + fail("This should not happen"); } catch (Exception e) { String message = ERROR_MESSAGES.getProperty("errMessage.UniqueConstraintViolation"); assertEquals("EntityExists [" + message + "]", e.getMessage()); @@ -122,7 +122,7 @@ public class ExceptionMapperITCase extends AbstractITCase { groupTO2.setRealm(SyncopeConstants.ROOT_REALM); try { createGroup(groupTO2); - fail(); + fail("This should not happen"); } catch (Exception e) { String message = ERROR_MESSAGES.getProperty("errMessage.UniqueConstraintViolation"); assertEquals("DataIntegrityViolation [" + message + "]", e.getMessage()); @@ -143,7 +143,7 @@ public class ExceptionMapperITCase extends AbstractITCase { try { createUser(userTO); - fail(); + fail("This should not happen"); } catch (SyncopeClientCompositeException e) { assertEquals(2, e.getExceptions().size()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java index 817d8e4..3b8db05 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/GroupITCase.java @@ -18,12 +18,12 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.security.AccessControlException; import java.util.Collections; @@ -90,7 +90,7 @@ import org.apache.syncope.common.rest.api.service.GroupService; import org.apache.syncope.common.rest.api.service.SyncopeService; import org.apache.syncope.core.provisioning.java.job.TaskJob; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class GroupITCase extends AbstractITCase { @@ -203,7 +203,7 @@ public class GroupITCase extends AbstractITCase { try { groupService2.read("29f96485-729e-4d31-88a1-6fc60e4677f3"); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.DelegatedAdministration, e.getType()); } @@ -289,7 +289,7 @@ public class GroupITCase extends AbstractITCase { try { groupService2.update(groupPatch); - fail(); + fail("This should not happen"); } catch (ForbiddenException e) { assertNotNull(e); } @@ -340,7 +340,7 @@ public class GroupITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -357,7 +357,7 @@ public class GroupITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -387,7 +387,7 @@ public class GroupITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), groupTO.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -409,7 +409,7 @@ public class GroupITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), groupTO.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -456,7 +456,7 @@ public class GroupITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), groupTO.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -478,7 +478,7 @@ public class GroupITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), groupTO.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -513,7 +513,7 @@ public class GroupITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), groupTO.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -544,7 +544,7 @@ public class GroupITCase extends AbstractITCase { try { resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), groupTO.getKey()); - fail(); + fail("This should not happen"); } catch (Exception e) { assertNotNull(e); } @@ -586,7 +586,7 @@ public class GroupITCase extends AbstractITCase { try { updateGroup(groupPatch); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType()); } @@ -611,7 +611,7 @@ public class GroupITCase extends AbstractITCase { GroupService unauthenticated = clientFactory.create().getService(GroupService.class); try { unauthenticated.search(new AnyQuery.Builder().realm("/even").build()); - fail(); + fail("This should not happen"); } catch (AccessControlException e) { assertNotNull(e); } @@ -621,7 +621,7 @@ public class GroupITCase extends AbstractITCase { try { anonymous.getService(GroupService.class). search(new AnyQuery.Builder().realm("/even").build()); - fail(); + fail("This should not happen"); } catch (ForbiddenException e) { assertNotNull(e); } @@ -861,7 +861,7 @@ public class GroupITCase extends AbstractITCase { // 4. verify that the user above is not found on LDAP try { resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.USER.name(), userTO.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/IdentityRecertificationITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/IdentityRecertificationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/IdentityRecertificationITCase.java index 00f8fdb..ea43662 100755 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/IdentityRecertificationITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/IdentityRecertificationITCase.java @@ -18,17 +18,14 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; import org.apache.syncope.common.lib.to.WorkflowFormPropertyTO; import org.apache.syncope.common.lib.to.WorkflowFormTO; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runners.MethodSorters; +import org.junit.jupiter.api.Test; -@FixMethodOrder(MethodSorters.JVM) public class IdentityRecertificationITCase extends AbstractTaskITCase { @Test http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/JWTITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/JWTITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/JWTITCase.java index 93ae426..1d1c77f 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/JWTITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/JWTITCase.java @@ -18,11 +18,11 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.security.AccessControlException; import java.text.ParseException; @@ -54,7 +54,7 @@ import org.apache.syncope.common.rest.api.service.AccessTokenService; import org.apache.syncope.common.rest.api.service.UserSelfService; import org.apache.syncope.fit.AbstractITCase; import org.apache.syncope.fit.core.reference.CustomJWTSSOProvider; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Some tests for JWT Tokens. http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java index 5ba1c9e..f7fe298 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java @@ -18,11 +18,11 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; import java.io.File; import java.io.IOException; @@ -58,7 +58,7 @@ import org.apache.syncope.core.logic.ResourceLogic; import org.apache.syncope.core.logic.GroupLogic; import org.apache.syncope.core.logic.UserLogic; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class LoggerITCase extends AbstractITCase { http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MailTemplateITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MailTemplateITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MailTemplateITCase.java index b7c79a0..df00728 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MailTemplateITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MailTemplateITCase.java @@ -18,11 +18,11 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.io.InputStream; @@ -36,7 +36,7 @@ import org.apache.syncope.common.lib.to.MailTemplateTO; import org.apache.syncope.common.lib.types.ClientExceptionType; import org.apache.syncope.common.lib.types.MailTemplateFormat; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class MailTemplateITCase extends AbstractITCase { @@ -70,13 +70,13 @@ public class MailTemplateITCase extends AbstractITCase { // 2. attempt to read HTML and TEXT -> fail try { mailTemplateService.getFormat(key, MailTemplateFormat.HTML); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } try { mailTemplateService.getFormat(key, MailTemplateFormat.TEXT); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -112,7 +112,7 @@ public class MailTemplateITCase extends AbstractITCase { try { mailTemplateService.getFormat(key, MailTemplateFormat.HTML); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -130,19 +130,19 @@ public class MailTemplateITCase extends AbstractITCase { try { mailTemplateService.read(key); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } try { mailTemplateService.getFormat(key, MailTemplateFormat.HTML); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } try { mailTemplateService.getFormat(key, MailTemplateFormat.TEXT); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -154,7 +154,7 @@ public class MailTemplateITCase extends AbstractITCase { mailTemplateTO.setKey("optin"); try { mailTemplateService.create(mailTemplateTO); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.EntityExists, e.getType()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java index 3511552..a4f6ac5 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MembershipITCase.java @@ -18,11 +18,11 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import javax.sql.DataSource; import javax.ws.rs.core.Response; @@ -52,15 +52,12 @@ import org.apache.syncope.common.lib.types.ResourceDeassociationAction; import org.apache.syncope.common.rest.api.beans.AnyQuery; import org.apache.syncope.common.rest.api.service.TaskService; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:testJDBCEnv.xml" }) +@SpringJUnitConfig(locations = { "classpath:testJDBCEnv.xml" }) public class MembershipITCase extends AbstractITCase { @Autowired @@ -86,7 +83,7 @@ public class MembershipITCase extends AbstractITCase { // user creation fails because of fullname try { createUser(user); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidUser, e.getType()); assertTrue(e.getMessage().contains("InvalidPlainAttr: fullname not allowed for membership of group")); http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java index b28e257..f98d468 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java @@ -18,10 +18,10 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.fail; import java.util.List; import java.util.Locale; @@ -61,12 +61,12 @@ import org.apache.syncope.common.rest.api.service.TaskService; import org.apache.syncope.common.rest.api.service.UserService; import org.apache.syncope.fit.AbstractITCase; import org.identityconnectors.framework.common.objects.ObjectClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class MultitenancyITCase extends AbstractITCase { - @BeforeClass + @BeforeAll public static void restSetup() { clientFactory = new SyncopeClientFactoryBean().setAddress(ADDRESS).setDomain("Two"); @@ -83,14 +83,14 @@ public class MultitenancyITCase extends AbstractITCase { public void masterOnly() { try { adminClient.getService(DomainService.class).read("Two"); - fail(); + fail("This should not happen"); } catch (ForbiddenException e) { assertNotNull(e); } try { adminClient.getService(LoggerService.class).list(LoggerType.LOG); - fail(); + fail("This should not happen"); } catch (ForbiddenException e) { assertNotNull(e); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationITCase.java index bb0f976..5b104ec 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationITCase.java @@ -18,11 +18,11 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.List; import javax.ws.rs.core.Response; @@ -34,7 +34,7 @@ import org.apache.syncope.common.lib.types.ClientExceptionType; import org.apache.syncope.common.lib.types.TraceLevel; import org.apache.syncope.common.rest.api.service.NotificationService; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class NotificationITCase extends AbstractITCase { @@ -111,7 +111,7 @@ public class NotificationITCase extends AbstractITCase { try { notificationService.read(notification.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -186,7 +186,7 @@ public class NotificationITCase extends AbstractITCase { try { notificationService.create(notificationTO); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType()); assertTrue(e.getMessage().contains("events")); http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java index a4ca1f4..6790f34 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/NotificationTaskITCase.java @@ -18,10 +18,10 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import javax.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; @@ -41,7 +41,7 @@ import org.apache.syncope.common.rest.api.beans.TaskQuery; import org.apache.syncope.common.rest.api.service.NotificationService; import org.apache.syncope.core.provisioning.java.job.notification.NotificationJob; import org.apache.syncope.fit.core.reference.TestNotificationRecipientsProvider; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class NotificationTaskITCase extends AbstractNotificationTaskITCase { @@ -64,11 +64,9 @@ public class NotificationTaskITCase extends AbstractNotificationTaskITCase { assertNotNull(taskTO); assertTrue(taskTO.isExecuted()); assertNotNull(taskTO.getTextBody()); - assertTrue("Notification mail text doesn't contain expected content.", - taskTO.getTextBody().contains("Your email address is " + created.getRight() + ".")); - assertTrue("Notification mail text doesn't contain expected content.", - taskTO.getTextBody().contains("Your email address inside a link: " - + "http://localhost/?email=" + created.getRight().replaceAll("@", "%40"))); + assertTrue(taskTO.getTextBody().contains("Your email address is " + created.getRight() + ".")); + assertTrue(taskTO.getTextBody().contains("Your email address inside a link: " + + "http://localhost/?email=" + created.getRight().replaceAll("@", "%40"))); } @Test http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PlainSchemaITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PlainSchemaITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PlainSchemaITCase.java index 152fcdd..79a31e9 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PlainSchemaITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PlainSchemaITCase.java @@ -18,12 +18,12 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.List; import javax.ws.rs.core.GenericType; @@ -42,7 +42,7 @@ import org.apache.syncope.common.lib.types.EntityViolationType; import org.apache.syncope.common.lib.types.SchemaType; import org.apache.syncope.common.rest.api.beans.SchemaQuery; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PlainSchemaITCase extends AbstractITCase { @@ -63,7 +63,7 @@ public class PlainSchemaITCase extends AbstractITCase { try { createSchema(SchemaType.PLAIN, schemaTO); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.EntityExists, e.getType()); } @@ -293,7 +293,7 @@ public class PlainSchemaITCase extends AbstractITCase { try { createSchema(SchemaType.PLAIN, actual); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(Response.Status.CONFLICT, e.getType().getResponseStatus()); assertEquals(ClientExceptionType.EntityExists, e.getType()); @@ -302,7 +302,7 @@ public class PlainSchemaITCase extends AbstractITCase { actual.setKey(null); try { createSchema(SchemaType.PLAIN, actual); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(Response.Status.BAD_REQUEST, e.getType().getResponseStatus()); assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType()); @@ -316,7 +316,7 @@ public class PlainSchemaITCase extends AbstractITCase { try { createSchema(SchemaType.PLAIN, schema); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidPlainSchema, e.getType()); assertTrue(e.getElements().iterator().next().contains(EntityViolationType.InvalidKey.name())); http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java index 7b8d6d9..40664f0 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java @@ -18,12 +18,12 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.Arrays; import java.util.List; @@ -40,7 +40,7 @@ import org.apache.syncope.common.lib.types.PolicyType; import org.apache.syncope.common.lib.policy.PullPolicySpec; import org.apache.syncope.fit.AbstractITCase; import org.apache.syncope.fit.core.reference.TestPullRule; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PolicyITCase extends AbstractITCase { @@ -97,7 +97,7 @@ public class PolicyITCase extends AbstractITCase { try { createPolicy(policy); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidPolicy, e.getType()); } @@ -148,7 +148,7 @@ public class PolicyITCase extends AbstractITCase { try { policyService.read(policyTO.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertNotNull(e); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java index 20b61ac..c1ae0b8 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PropagationTaskITCase.java @@ -18,10 +18,10 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.List; @@ -43,7 +43,7 @@ import org.apache.syncope.common.lib.types.TaskType; import org.apache.syncope.common.rest.api.beans.ExecuteQuery; import org.apache.syncope.common.rest.api.beans.ExecQuery; import org.apache.syncope.common.rest.api.beans.TaskQuery; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class PropagationTaskITCase extends AbstractTaskITCase { http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java index 0919b77..699d317 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java @@ -18,12 +18,12 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -86,22 +86,19 @@ import org.apache.syncope.fit.core.reference.TestReconciliationFilterBuilder; import org.apache.syncope.fit.core.reference.TestPullActions; import org.apache.syncope.fit.core.reference.TestPullRule; import org.identityconnectors.framework.common.objects.Name; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:testJDBCEnv.xml" }) +@SpringJUnitConfig(locations = { "classpath:testJDBCEnv.xml" }) public class PullTaskITCase extends AbstractTaskITCase { @Autowired private DataSource testDataSource; - @BeforeClass + @BeforeAll public static void testPullActionsSetup() { PullTaskTO pullTask = taskService.read(PULL_TASK_KEY, true); pullTask.getActionsClassNames().add(TestPullActions.class.getName()); @@ -121,7 +118,7 @@ public class PullTaskITCase extends AbstractTaskITCase { assertFalse(tasks.getResult().isEmpty()); tasks.getResult().stream(). filter(task -> (!(task instanceof PullTaskTO))). - forEach(item -> fail()); + forEach(item -> fail("This should not happen")); } @Test @@ -255,7 +252,7 @@ public class PullTaskITCase extends AbstractTaskITCase { // Check for ignored user - SYNCOPE-663 try { userService.read("test2"); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus()); } @@ -287,9 +284,7 @@ public class PullTaskITCase extends AbstractTaskITCase { @Test public void dryRun() { ExecTO execution = execProvisioningTask(taskService, PULL_TASK_KEY, 50, true); - assertEquals( - "Execution of " + execution.getRefDesc() + " failed with message " + execution.getMessage(), - "SUCCESS", execution.getStatus()); + assertEquals("SUCCESS", execution.getStatus()); } @Test @@ -402,9 +397,6 @@ public class PullTaskITCase extends AbstractTaskITCase { @Test public void reconcileFromScriptedSQL() { - System.out.println("QUAAAAAAAAAAAAAAAAAAAAA"); - LOG.info("QUAAAAAAAAAAAAAAAa"); - // 0. reset sync token and set MappingItemTransformer ResourceTO resource = resourceService.read(RESOURCE_NAME_DBSCRIPTED); ResourceTO originalResource = SerializationUtils.clone(resource); @@ -519,7 +511,7 @@ public class PullTaskITCase extends AbstractTaskITCase { try { userService.read("user1"); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -768,8 +760,8 @@ public class PullTaskITCase extends AbstractTaskITCase { assertEquals(1, executed.getExecutions().size()); // asser for just one match - assertTrue(executed.getExecutions().get(0).getMessage().substring(0, 55) + "...", - executed.getExecutions().get(0).getMessage().contains("[updated/failures]: 1/0")); + assertTrue(executed.getExecutions().get(0).getMessage().contains("[updated/failures]: 1/0"), + executed.getExecutions().get(0).getMessage().substring(0, 55) + "..."); } @Test http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java index 368acde..17d9c05 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PushTaskITCase.java @@ -18,12 +18,12 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.HashSet; import java.util.Set; @@ -57,15 +57,12 @@ import org.apache.syncope.common.rest.api.service.NotificationService; import org.apache.syncope.common.rest.api.service.ResourceService; import org.apache.syncope.common.rest.api.service.TaskService; import org.identityconnectors.framework.common.objects.ObjectClass; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:testJDBCEnv.xml" }) +@SpringJUnitConfig(locations = { "classpath:testJDBCEnv.xml" }) public class PushTaskITCase extends AbstractTaskITCase { @Autowired @@ -91,7 +88,7 @@ public class PushTaskITCase extends AbstractTaskITCase { assertFalse(tasks.getResult().isEmpty()); tasks.getResult().stream(). filter((task) -> (!(task instanceof PushTaskTO))). - forEach(item -> fail()); + forEach(item -> fail("This should not happen")); } @Test http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RESTITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RESTITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RESTITCase.java index b9d605f..2cee05f 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RESTITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RESTITCase.java @@ -18,11 +18,11 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.io.InputStream; @@ -58,7 +58,7 @@ import org.apache.syncope.common.rest.api.service.ConnectorService; import org.apache.syncope.common.rest.api.service.GroupService; import org.apache.syncope.common.rest.api.service.UserService; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class RESTITCase extends AbstractITCase { @@ -72,7 +72,7 @@ public class RESTITCase extends AbstractITCase { // service with bad password: 401 unauthorized try { clientFactory.create("bellini", "passwor"); - fail(); + fail("This should not happen"); } catch (AccessControlException e) { assertNotNull(e); } @@ -81,7 +81,7 @@ public class RESTITCase extends AbstractITCase { SyncopeClient goodClient = clientFactory.create("bellini", "password"); try { goodClient.getService(ConnectorService.class).list(null); - fail(); + fail("This should not happen"); } catch (ForbiddenException e) { assertNotNull(e); } @@ -149,7 +149,7 @@ public class RESTITCase extends AbstractITCase { userPatch.setUsername(new StringReplacePatchItem.Builder().value(userTO.getUsername() + "YY").build()); try { ifMatchService.update(userPatch); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.ConcurrentModification, e.getType()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java index cdf8ffc..751b9d3 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RealmITCase.java @@ -18,12 +18,12 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.List; import java.util.Optional; @@ -39,7 +39,7 @@ import org.apache.syncope.common.lib.types.ClientExceptionType; import org.apache.syncope.common.lib.types.PropagationTaskExecStatus; import org.apache.syncope.common.rest.api.service.RealmService; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class RealmITCase extends AbstractITCase { @@ -58,7 +58,7 @@ public class RealmITCase extends AbstractITCase { try { realmService.list("a name"); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidPath, e.getType()); } @@ -105,7 +105,7 @@ public class RealmITCase extends AbstractITCase { // 4. create under invalid path try { realmService.create("a name", realm); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidPath, e.getType()); } @@ -113,7 +113,7 @@ public class RealmITCase extends AbstractITCase { // 5. attempt to create duplicate try { realmService.create("/odd", realm); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.EntityExists, e.getType()); } @@ -168,7 +168,7 @@ public class RealmITCase extends AbstractITCase { try { realmService.list(actual.getFullPath()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -178,7 +178,7 @@ public class RealmITCase extends AbstractITCase { public void deleteNonEmpty() { try { realmService.delete("/even/two"); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.AssociatedAnys, e.getType()); assertEquals(3, e.getElements().size()); http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RelationshipTypeITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RelationshipTypeITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RelationshipTypeITCase.java index 0afa80e..4c446c4 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RelationshipTypeITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RelationshipTypeITCase.java @@ -18,10 +18,10 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; import java.util.List; import javax.ws.rs.core.Response; @@ -30,7 +30,7 @@ import org.apache.syncope.common.lib.to.RelationshipTypeTO; import org.apache.syncope.common.lib.types.ClientExceptionType; import org.apache.syncope.common.rest.api.service.RelationshipTypeService; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class RelationshipTypeITCase extends AbstractITCase { @@ -71,7 +71,7 @@ public class RelationshipTypeITCase extends AbstractITCase { try { relationshipTypeService.read(newType.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -83,7 +83,7 @@ public class RelationshipTypeITCase extends AbstractITCase { newType.setKey("membership"); try { relationshipTypeService.create(newType); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidRelationshipType, e.getType()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java index 530a377..01965ab 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java @@ -18,11 +18,11 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.io.InputStream; @@ -50,7 +50,7 @@ import org.apache.syncope.common.lib.types.ReportExecStatus; import org.apache.syncope.common.rest.api.beans.BulkExecDeleteQuery; import org.apache.syncope.common.rest.api.beans.ExecuteQuery; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ReportITCase extends AbstractITCase { @@ -133,7 +133,7 @@ public class ReportITCase extends AbstractITCase { try { reportService.read(report.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus()); } @@ -193,7 +193,7 @@ public class ReportITCase extends AbstractITCase { try { execute(reportTO.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.Scheduling, e.getType()); assertTrue(e.getElements().iterator().next().contains("active")); http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportTemplateITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportTemplateITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportTemplateITCase.java index c0882ee..6e7fc60 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportTemplateITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportTemplateITCase.java @@ -18,11 +18,11 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.io.InputStream; @@ -36,7 +36,7 @@ import org.apache.syncope.common.lib.to.ReportTemplateTO; import org.apache.syncope.common.lib.types.ClientExceptionType; import org.apache.syncope.common.lib.types.ReportTemplateFormat; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ReportTemplateITCase extends AbstractITCase { @@ -70,13 +70,13 @@ public class ReportTemplateITCase extends AbstractITCase { // 2. attempt to read HTML and CSV -> fail try { reportTemplateService.getFormat(key, ReportTemplateFormat.HTML); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } try { reportTemplateService.getFormat(key, ReportTemplateFormat.CSV); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -114,7 +114,7 @@ public class ReportTemplateITCase extends AbstractITCase { try { reportTemplateService.getFormat(key, ReportTemplateFormat.HTML); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -132,19 +132,19 @@ public class ReportTemplateITCase extends AbstractITCase { try { reportTemplateService.read(key); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } try { reportTemplateService.getFormat(key, ReportTemplateFormat.HTML); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } try { reportTemplateService.getFormat(key, ReportTemplateFormat.CSV); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); } @@ -156,7 +156,7 @@ public class ReportTemplateITCase extends AbstractITCase { reportTemplateTO.setKey("empty"); try { reportTemplateService.create(reportTemplateTO); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.EntityExists, e.getType()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java index 1537553..6a318ee 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java @@ -18,13 +18,14 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.ArrayList; import java.util.Arrays; @@ -59,7 +60,7 @@ import org.apache.syncope.common.rest.api.beans.ConnObjectTOListQuery; import org.apache.syncope.common.rest.api.service.ResourceService; import org.identityconnectors.framework.common.objects.ObjectClass; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ResourceITCase extends AbstractITCase { @@ -262,33 +263,35 @@ public class ResourceITCase extends AbstractITCase { } } - @Test(expected = SyncopeClientException.class) + @Test public void createWithoutExtAttr() { - String resourceKey = RESOURCE_NAME_CREATE_WRONG; - ResourceTO resourceTO = new ResourceTO(); - resourceTO.setKey(resourceKey); - resourceTO.setConnector("5ffbb4ac-a8c3-4b44-b699-11b398a1ba08"); + assertThrows(SyncopeClientException.class, () -> { + String resourceKey = RESOURCE_NAME_CREATE_WRONG; + ResourceTO resourceTO = new ResourceTO(); + resourceTO.setKey(resourceKey); + resourceTO.setConnector("5ffbb4ac-a8c3-4b44-b699-11b398a1ba08"); - ProvisionTO provisionTO = new ProvisionTO(); - provisionTO.setAnyType(AnyTypeKind.USER.name()); - provisionTO.setObjectClass(ObjectClass.ACCOUNT_NAME); - resourceTO.getProvisions().add(provisionTO); + ProvisionTO provisionTO = new ProvisionTO(); + provisionTO.setAnyType(AnyTypeKind.USER.name()); + provisionTO.setObjectClass(ObjectClass.ACCOUNT_NAME); + resourceTO.getProvisions().add(provisionTO); - MappingTO mapping = new MappingTO(); - provisionTO.setMapping(mapping); + MappingTO mapping = new MappingTO(); + provisionTO.setMapping(mapping); - ItemTO item = new ItemTO(); - item.setIntAttrName("key"); - item.setExtAttrName("userId"); - item.setConnObjectKey(true); - mapping.setConnObjectKeyItem(item); + ItemTO item = new ItemTO(); + item.setIntAttrName("key"); + item.setExtAttrName("userId"); + item.setConnObjectKey(true); + mapping.setConnObjectKeyItem(item); - item = new ItemTO(); - item.setIntAttrName("usernane"); - // missing extAttrName ... - mapping.add(item); + item = new ItemTO(); + item.setIntAttrName("usernane"); + // missing extAttrName ... + mapping.add(item); - createResource(resourceTO); + createResource(resourceTO); + }); } @Test @@ -332,7 +335,7 @@ public class ResourceITCase extends AbstractITCase { resourceTO.setKey("resourcenotfound"); resourceService.update(resourceTO); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus()); } @@ -390,7 +393,7 @@ public class ResourceITCase extends AbstractITCase { public void deleteWithException() { try { resourceService.delete("resourcenotfound"); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus()); } @@ -444,7 +447,7 @@ public class ResourceITCase extends AbstractITCase { try { resourceService.read(resourceKey); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus()); } @@ -606,7 +609,7 @@ public class ResourceITCase extends AbstractITCase { // 1. attempt to read a resource for a connector with a different admin realm: fail try { prs.read(RESOURCE_NAME_WS1); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.DelegatedAdministration, e.getType()); } @@ -635,7 +638,7 @@ public class ResourceITCase extends AbstractITCase { try { createResource(actual); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(Response.Status.CONFLICT, e.getType().getResponseStatus()); assertEquals(ClientExceptionType.EntityExists, e.getType()); @@ -644,7 +647,7 @@ public class ResourceITCase extends AbstractITCase { actual.setKey(null); try { createResource(actual); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(Response.Status.BAD_REQUEST, e.getType().getResponseStatus()); assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType()); @@ -707,7 +710,7 @@ public class ResourceITCase extends AbstractITCase { try { resourceService.create( buildResourceTO("http://schemas.examples.org/security/authorization/organizationUnit")); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidExternalResource, e.getType()); assertTrue(e.getElements().iterator().next().contains(EntityViolationType.InvalidKey.name())); @@ -781,7 +784,7 @@ public class ResourceITCase extends AbstractITCase { // save the resource try { resourceService.create(resource); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidMapping, e.getType()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/45ad6f55/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RoleITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RoleITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RoleITCase.java index fe71fd1..730c7fa 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RoleITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RoleITCase.java @@ -18,11 +18,11 @@ */ package org.apache.syncope.fit.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.List; import javax.ws.rs.core.Response; @@ -33,7 +33,7 @@ import org.apache.syncope.common.lib.types.ClientExceptionType; import org.apache.syncope.common.lib.types.StandardEntitlement; import org.apache.syncope.common.rest.api.service.RoleService; import org.apache.syncope.fit.AbstractITCase; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class RoleITCase extends AbstractITCase { @@ -73,7 +73,7 @@ public class RoleITCase extends AbstractITCase { try { createRole(role); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.InvalidRole, e.getType()); } @@ -114,7 +114,7 @@ public class RoleITCase extends AbstractITCase { try { roleService.read(actual.getKey()); - fail(); + fail("This should not happen"); } catch (SyncopeClientException e) { assertEquals(ClientExceptionType.NotFound, e.getType()); }
