diff --git a/com.avaloq.tools.ddk.typesystem.test/META-INF/MANIFEST.MF b/com.avaloq.tools.ddk.typesystem.test/META-INF/MANIFEST.MF index 8d7db395f2..c03c17f2bb 100644 --- a/com.avaloq.tools.ddk.typesystem.test/META-INF/MANIFEST.MF +++ b/com.avaloq.tools.ddk.typesystem.test/META-INF/MANIFEST.MF @@ -9,9 +9,9 @@ Bundle-ActivationPolicy: lazy Fragment-Host: com.avaloq.tools.ddk.typesystem Require-Bundle: com.google.inject, com.google.guava, - org.junit, junit-jupiter-api, junit-jupiter-engine, - junit-vintage-engine + junit-vintage-engine, + junit-platform-suite-api Export-Package: com.avaloq.tools.ddk.typesystem.test Automatic-Module-Name: com.avaloq.tools.ddk.typesystem.test diff --git a/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/AbstractTypeProviderTest.java b/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/AbstractTypeProviderTest.java index 83bc6e7f42..02a2dc82c2 100644 --- a/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/AbstractTypeProviderTest.java +++ b/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/AbstractTypeProviderTest.java @@ -10,9 +10,9 @@ *******************************************************************************/ package com.avaloq.tools.ddk.typesystem; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +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 java.util.Arrays; @@ -23,8 +23,8 @@ import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EcoreFactory; import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import com.avaloq.tools.ddk.typesystem.typemodel.IExpression; import com.avaloq.tools.ddk.typesystem.typemodel.INamedElement; @@ -34,7 +34,7 @@ @SuppressWarnings("nls") -public class AbstractTypeProviderTest { +class AbstractTypeProviderTest { protected class TypeImpl extends EObjectImpl implements IType { } @@ -70,8 +70,8 @@ private EClass createEClass(final String name, final EClass... superTypes) { return clazz; } - @Before - public void init() { + @BeforeEach + void init() { EcoreFactory modelFactory = EcoreFactory.eINSTANCE; testModelPackage = modelFactory.createEPackage(); testModelPackage.setName("TypeProviderTestEPackage"); @@ -93,82 +93,82 @@ public void init() { } private void testPlainProvider(final ITypeProvider plainProvider) { - assertEquals("type for expression1 not type1", type1, plainProvider.getType(expression1)); - assertEquals("type for expression2 not type2", type2, plainProvider.getType(expression2)); - assertNull("type for expression3 not null", plainProvider.getType(expression3)); - assertNull("type for null not null", plainProvider.getType(null)); - assertEquals("expected type for container1 not type1", type1, plainProvider.getExpectedType((IExpression) expression1Container.eGet(expressionContainerReference))); - assertEquals("expected type for container2 not type2", type2, plainProvider.getExpectedType((IExpression) expression2Container.eGet(expressionContainerReference))); - assertNull("expected type for container3 not null", plainProvider.getExpectedType((IExpression) expression3Container.eGet(expressionContainerReference))); - assertNull("expected type for null not null", plainProvider.getExpectedType(null)); - assertEquals("type for namedElement1 not type1", type1, plainProvider.getTypeForNamedElement(namedElement1)); - assertEquals("type for namedElement2 not type2", type2, plainProvider.getTypeForNamedElement(namedElement2)); - assertNull("type for namedElement3 not null", plainProvider.getTypeForNamedElement(namedElement3)); - assertNull("type for named element null not null", plainProvider.getTypeForNamedElement(null)); + assertEquals(type1, plainProvider.getType(expression1), "type for expression1 not type1"); + assertEquals(type2, plainProvider.getType(expression2), "type for expression2 not type2"); + assertNull(plainProvider.getType(expression3), "type for expression3 not null"); + assertNull(plainProvider.getType(null), "type for null not null"); + assertEquals(type1, plainProvider.getExpectedType((IExpression) expression1Container.eGet(expressionContainerReference)), "expected type for container1 not type1"); + assertEquals(type2, plainProvider.getExpectedType((IExpression) expression2Container.eGet(expressionContainerReference)), "expected type for container2 not type2"); + assertNull(plainProvider.getExpectedType((IExpression) expression3Container.eGet(expressionContainerReference)), "expected type for container3 not null"); + assertNull(plainProvider.getExpectedType(null), "expected type for null not null"); + assertEquals(type1, plainProvider.getTypeForNamedElement(namedElement1), "type for namedElement1 not type1"); + assertEquals(type2, plainProvider.getTypeForNamedElement(namedElement2), "type for namedElement2 not type2"); + assertNull(plainProvider.getTypeForNamedElement(namedElement3), "type for namedElement3 not null"); + assertNull(plainProvider.getTypeForNamedElement(null), "type for named element null not null"); } @Test - public void testTypeProviderPlain() { + void testTypeProviderPlain() { ITypeProvider provider = new PlainTypeProvider(); testPlainProvider(provider); } @Test - public void testTypeProviderCyclicDefault() { + void testTypeProviderCyclicDefault() { ITypeProvider provider = new CyclicDefaultTypeProvider(); - assertNull("cylic type for expression1 not null", provider.getType(expression1)); - assertNull("cylic type for expression2 not null", provider.getType(expression2)); - assertNull("cyclic expected type for container1 not null", provider.getExpectedType((IExpression) expression1Container.eGet(expressionContainerReference))); - assertNull("cyclic expected type for container2 not null", provider.getExpectedType((IExpression) expression2Container.eGet(expressionContainerReference))); - assertNull("cyclic type for namedElement1 not null", provider.getTypeForNamedElement(namedElement1)); - assertNull("cyclic type for namedElement2 not null", provider.getTypeForNamedElement(namedElement2)); + assertNull(provider.getType(expression1), "cylic type for expression1 not null"); + assertNull(provider.getType(expression2), "cylic type for expression2 not null"); + assertNull(provider.getExpectedType((IExpression) expression1Container.eGet(expressionContainerReference)), "cyclic expected type for container1 not null"); + assertNull(provider.getExpectedType((IExpression) expression2Container.eGet(expressionContainerReference)), "cyclic expected type for container2 not null"); + assertNull(provider.getTypeForNamedElement(namedElement1), "cyclic type for namedElement1 not null"); + assertNull(provider.getTypeForNamedElement(namedElement2), "cyclic type for namedElement2 not null"); } @Test - public void testTypeProviderCyclicOverride() { + void testTypeProviderCyclicOverride() { ITypeProvider provider = new CyclicOverrideTypeProvider(); - assertEquals("cyclic override type for expression1 not type1", type1, provider.getType(expression1)); - assertEquals("cyclic override type for expression2 not type1", type1, provider.getType(expression2)); - assertEquals("cyclic override expected type for container1 not type2", type2, provider.getExpectedType((IExpression) expression1Container.eGet(expressionContainerReference))); - assertEquals("cyclic override expected type for container2 not type2", type2, provider.getExpectedType((IExpression) expression2Container.eGet(expressionContainerReference))); - assertEquals("cyclic override type for namedElement1 not type3", type3, provider.getTypeForNamedElement(namedElement1)); - assertEquals("cyclic override type for namedElement2 not type3", type3, provider.getTypeForNamedElement(namedElement2)); + assertEquals(type1, provider.getType(expression1), "cyclic override type for expression1 not type1"); + assertEquals(type1, provider.getType(expression2), "cyclic override type for expression2 not type1"); + assertEquals(type2, provider.getExpectedType((IExpression) expression1Container.eGet(expressionContainerReference)), "cyclic override expected type for container1 not type2"); + assertEquals(type2, provider.getExpectedType((IExpression) expression2Container.eGet(expressionContainerReference)), "cyclic override expected type for container2 not type2"); + assertEquals(type3, provider.getTypeForNamedElement(namedElement1), "cyclic override type for namedElement1 not type3"); + assertEquals(type3, provider.getTypeForNamedElement(namedElement2), "cyclic override type for namedElement2 not type3"); } @Test - public void testTypeProviderCyclicOverrideMixed() { + void testTypeProviderCyclicOverrideMixed() { ITypeProvider provider = new CyclicOverrideMixedTypeProvider(); - assertEquals("cyclic mixed type for expression1 not type1", type1, provider.getType(expression1)); - assertEquals("cyclic mixed type for expression2 not type1", type1, provider.getType(expression2)); - assertEquals("cyclic mixed expected type for container1 not type2", type2, provider.getExpectedType((IExpression) expression1Container.eGet(expressionContainerReference))); - assertEquals("cyclic mixed expected type for container2 not type2", type2, provider.getExpectedType((IExpression) expression2Container.eGet(expressionContainerReference))); - assertEquals("cyclic mixed type for namedElement1 not type1", type1, provider.getTypeForNamedElement(namedElement1)); - assertEquals("cyclic mixed type for namedElement2 not type1", type1, provider.getTypeForNamedElement(namedElement2)); + assertEquals(type1, provider.getType(expression1), "cyclic mixed type for expression1 not type1"); + assertEquals(type1, provider.getType(expression2), "cyclic mixed type for expression2 not type1"); + assertEquals(type2, provider.getExpectedType((IExpression) expression1Container.eGet(expressionContainerReference)), "cyclic mixed expected type for container1 not type2"); + assertEquals(type2, provider.getExpectedType((IExpression) expression2Container.eGet(expressionContainerReference)), "cyclic mixed expected type for container2 not type2"); + assertEquals(type1, provider.getTypeForNamedElement(namedElement1), "cyclic mixed type for namedElement1 not type1"); + assertEquals(type1, provider.getTypeForNamedElement(namedElement2), "cyclic mixed type for namedElement2 not type1"); } @Test - public void testDelegatingTypeProvider() { + void testDelegatingTypeProvider() { delegateProvider = new PlainTypeProvider(); testPlainProvider(new DelegatingTypeProvider()); } @Test - public void testDoNothingTypeProvider() { + void testDoNothingTypeProvider() { // we are mainly testing that the AbstractTypeProvider does not crash when the subclass does nothing ITypeProvider provider = new DoNothingTypeProvider(); - assertNull("did something for type of expression1", provider.getType(expression1)); - assertNull("did something for type of expression2", provider.getType(expression2)); - assertNull("did something for type of expression3", provider.getType(expression3)); - assertNull("did something for type of null", provider.getType(null)); - assertNull("did something for expected type of expression1", provider.getExpectedType((IExpression) expression1Container.eGet(expressionContainerReference))); - assertNull("did something for expected type of expression2", provider.getExpectedType((IExpression) expression2Container.eGet(expressionContainerReference))); - assertNull("did something for expected type of expression3", provider.getExpectedType((IExpression) expression3Container.eGet(expressionContainerReference))); - assertNull("did something for expected type of null", provider.getExpectedType(null)); - assertNull("did something for type of namedElement1", provider.getTypeForNamedElement(namedElement1)); - assertNull("did something for type of namedElement2", provider.getTypeForNamedElement(namedElement2)); - assertNull("did something for type of namedElement3", provider.getTypeForNamedElement(namedElement3)); - assertNull("did something for type of namedElement null", provider.getTypeForNamedElement(null)); + assertNull(provider.getType(expression1), "did something for type of expression1"); + assertNull(provider.getType(expression2), "did something for type of expression2"); + assertNull(provider.getType(expression3), "did something for type of expression3"); + assertNull(provider.getType(null), "did something for type of null"); + assertNull(provider.getExpectedType((IExpression) expression1Container.eGet(expressionContainerReference)), "did something for expected type of expression1"); + assertNull(provider.getExpectedType((IExpression) expression2Container.eGet(expressionContainerReference)), "did something for expected type of expression2"); + assertNull(provider.getExpectedType((IExpression) expression3Container.eGet(expressionContainerReference)), "did something for expected type of expression3"); + assertNull(provider.getExpectedType(null), "did something for expected type of null"); + assertNull(provider.getTypeForNamedElement(namedElement1), "did something for type of namedElement1"); + assertNull(provider.getTypeForNamedElement(namedElement2), "did something for type of namedElement2"); + assertNull(provider.getTypeForNamedElement(namedElement3), "did something for type of namedElement3"); + assertNull(provider.getTypeForNamedElement(null), "did something for type of namedElement null"); } protected class PlainTypeProvider extends AbstractTypeProvider { @@ -348,7 +348,7 @@ protected boolean providesTypeForNamedElement(final INamedElement element) { @Override protected ITypeProvider getTypeProviderFor(final EObject eObject) { - assertNotNull("there is no delegate provider", delegateProvider); + assertNotNull(delegateProvider, "there is no delegate provider"); return delegateProvider; } diff --git a/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/BuiltInTypeModelAccessTest.java b/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/BuiltInTypeModelAccessTest.java index 401681d46d..d694f46be7 100644 --- a/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/BuiltInTypeModelAccessTest.java +++ b/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/BuiltInTypeModelAccessTest.java @@ -10,14 +10,14 @@ *******************************************************************************/ package com.avaloq.tools.ddk.typesystem; -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.assertSame; +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.assertSame; import org.eclipse.emf.common.util.EList; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.avaloq.tools.ddk.typesystem.builtintypemodel.BuiltInTypeModel; import com.avaloq.tools.ddk.typesystem.builtintypemodel.InternalType; @@ -28,29 +28,29 @@ * Tests that the BuiltInType model instance is correct and complete. */ @SuppressWarnings("nls") -public class BuiltInTypeModelAccessTest { +class BuiltInTypeModelAccessTest { @Test - public void testLoadModel() { + void testLoadModel() { BuiltInTypeModelAccess typeModelInstance = BuiltInTypeModelAccess.getInstance(); BuiltInTypeModel model = typeModelInstance.getModel(); - assertNotNull("Model was created", model); + assertNotNull(model, "Model was created"); EList types = model.getInternalTypes(); - assertFalse("Model has built-in internal types", types.isEmpty()); + assertFalse(types.isEmpty(), "Model has built-in internal types"); for (InternalType type : types) { String typeName = type.getName(); - assertFalse("Internal type has name", typeName == null || "".equals(typeName)); + assertFalse(typeName == null || "".equals(typeName), "Internal type has name"); } } private void assertPresence(final String name) { INamedType t = BuiltInTypeModelAccess.getInstance().getInternalType(name); - assertNotNull("Type \"" + name + "\" found", t); - assertEquals("Actual type name matches", name, t.getName()); + assertNotNull(t, "Type \"" + name + "\" found"); + assertEquals(name, t.getName(), "Actual type name matches"); } @Test - public void testHasInternalTypes() { + void testHasInternalTypes() { assertPresence(BuiltInTypeModelAccess.ANY_TYPE_NAME); assertPresence(BuiltInTypeModelAccess.ERROR_TYPE_NAME); assertPresence(BuiltInTypeModelAccess.UNDETERMINED_TYPE_NAME); @@ -58,14 +58,14 @@ public void testHasInternalTypes() { } @Test - public void testInvalidInternalTypeNames() { - assertNull("Null name returns null", BuiltInTypeModelAccess.getInstance().getInternalType(null)); - assertNull("Empty name returns null", BuiltInTypeModelAccess.getInstance().getInternalType("")); - assertNull("Non-existant name returns null", BuiltInTypeModelAccess.getInstance().getInternalType("xyz!!")); + void testInvalidInternalTypeNames() { + assertNull(BuiltInTypeModelAccess.getInstance().getInternalType(null), "Null name returns null"); + assertNull(BuiltInTypeModelAccess.getInstance().getInternalType(""), "Empty name returns null"); + assertNull(BuiltInTypeModelAccess.getInstance().getInternalType("xyz!!"), "Non-existant name returns null"); } @Test - public void testUniqueInternalTypes() { + void testUniqueInternalTypes() { assertUnique(BuiltInTypeModelAccess.ANY_TYPE_NAME); assertUnique(BuiltInTypeModelAccess.ERROR_TYPE_NAME); assertUnique(BuiltInTypeModelAccess.UNDETERMINED_TYPE_NAME); @@ -74,6 +74,6 @@ public void testUniqueInternalTypes() { private void assertUnique(final String typeName) { BuiltInTypeModelAccess instance = BuiltInTypeModelAccess.getInstance(); - assertSame("type " + typeName + " is unique", instance.getInternalType(typeName), instance.getInternalType(typeName)); + assertSame(instance.getInternalType(typeName), instance.getInternalType(typeName), "type " + typeName + " is unique"); } } diff --git a/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/ParameterListMatcherTest.java b/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/ParameterListMatcherTest.java index efb8ed0873..d252a16a75 100644 --- a/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/ParameterListMatcherTest.java +++ b/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/ParameterListMatcherTest.java @@ -10,9 +10,9 @@ *******************************************************************************/ package com.avaloq.tools.ddk.typesystem; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; import java.util.ArrayList; import java.util.List; @@ -20,7 +20,7 @@ import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.avaloq.tools.ddk.typesystem.IParameterMatchChecker.IMatchResult; import com.avaloq.tools.ddk.typesystem.ParameterListMatcher.ParameterListMatchResult; @@ -37,7 +37,7 @@ // You can't have too many tests @SuppressWarnings({"PMD.ExcessivePublicCount", "nls"}) -public class ParameterListMatcherTest { +class ParameterListMatcherTest { private static final String WRONG_NUMBER_OF_UNNAMED_FORMALS_AFTER_NAMED_FORMALS = "wrong number of unnamed formals after named formals"; private static final String UNNAMED_FORMAL_AFTER_NAMED_NOT_LOCATED = "unnamed formal after named not located"; @@ -190,33 +190,33 @@ public IMatchResult checkMatch(final IActualParameter actual, final IFormalParam private final NamedType textType = new NamedType("text"); private void checkParameterListResult(final ParameterListMatcher.ParameterListMatchStatus status, final int numberOfMatches, final int matchListSize, final ParameterListMatcher.ParameterListMatchResult result) { - assertSame("wrong list match status", status, result.getStatus()); - assertSame("wrong number of matched parameters", numberOfMatches, result.getNumberMatched()); - assertSame("wrong match list size", matchListSize, result.getMatches().size()); + assertSame(status, result.getStatus(), "wrong list match status"); + assertSame(numberOfMatches, result.getNumberMatched(), "wrong number of matched parameters"); + assertSame(matchListSize, result.getMatches().size(), "wrong match list size"); } private void checkParameterMatch(final IParameterMatchChecker.MatchStatus status, final ActualParameter actual, final FormalParameter formal, final ParameterListMatcher.ParameterMatch match) { - assertSame("wrong match status", status, match.getMatchResult().getStatus()); + assertSame(status, match.getMatchResult().getStatus(), "wrong match status"); if (actual == null) { - assertNull("match actual not null", match.getActualParameter()); + assertNull(match.getActualParameter(), "match actual not null"); } else { - assertEquals("wrong match actual", actual, match.getActualParameter()); + assertEquals(actual, match.getActualParameter(), "wrong match actual"); } if (formal == null) { - assertNull("match formal not null", match.getFormalParameter()); + assertNull(match.getFormalParameter(), "match formal not null"); } else { - assertEquals("wrong match formal", formal, match.getFormalParameter()); + assertEquals(formal, match.getFormalParameter(), "wrong match formal"); } } @Test - public void testNoneAgainstNone() { + void testNoneAgainstNone() { ParameterListMatchResult matchResult = parameterListMatcher.match(new ArrayList(), new ArrayList(), parameterMatcher, CASE_INSENSITIVE); checkParameterListResult(ParameterListMatchStatus.MATCH_SUCCESSFUL, 0, 0, matchResult); } @Test - public void testOneUnnamedAgainstOne() { + void testOneUnnamedAgainstOne() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); List actuals = new ArrayList(); @@ -228,7 +228,7 @@ public void testOneUnnamedAgainstOne() { } @Test - public void testOneNamedAgainstOne() { + void testOneNamedAgainstOne() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); List actuals = new ArrayList(); @@ -240,7 +240,7 @@ public void testOneNamedAgainstOne() { } @Test - public void testOneNamedAgainstOneCaseSensitive() { + void testOneNamedAgainstOneCaseSensitive() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1.toUpperCase(Locale.getDefault()), intType)); List actuals = new ArrayList(); @@ -261,7 +261,7 @@ public void testOneNamedAgainstOneCaseSensitive() { } @Test - public void testOneUnnamedAgainstNone() { + void testOneUnnamedAgainstNone() { List formals = new ArrayList(); List actuals = new ArrayList(); actuals.add(new ActualParameter(intType)); @@ -272,7 +272,7 @@ public void testOneUnnamedAgainstNone() { } @Test - public void testOneNamedAgainstNone() { + void testOneNamedAgainstNone() { List formals = new ArrayList(); List actuals = new ArrayList(); actuals.add(new NamedActualParameter(NAME_1, intType)); @@ -283,19 +283,19 @@ public void testOneNamedAgainstNone() { } @Test - public void testNoneAgainstOne() { + void testNoneAgainstOne() { List formals = new ArrayList(); NamedFormalParameter mandatoryParam = new NamedFormalParameter(NAME_1, intType); formals.add(mandatoryParam); List actuals = new ArrayList(); ParameterListMatchResult matchResult = parameterListMatcher.match(actuals, formals, parameterMatcher, CASE_INSENSITIVE); checkParameterListResult(ParameterListMatchStatus.MISSING_MANDATORY, 0, 0, matchResult); - assertSame(INCORRECT_NO_UNMATCHED_MANDATORY_FORMALS, 1, matchResult.getUnmatchedMandatoryFormalParameters().size()); - assertSame(INCORRECT_UNMATCHED_MANDATORY_FORMAL, mandatoryParam, matchResult.getUnmatchedMandatoryFormalParameters().get(0)); + assertSame(1, matchResult.getUnmatchedMandatoryFormalParameters().size(), INCORRECT_NO_UNMATCHED_MANDATORY_FORMALS); + assertSame(mandatoryParam, matchResult.getUnmatchedMandatoryFormalParameters().get(0), INCORRECT_UNMATCHED_MANDATORY_FORMAL); } @Test - public void testNoneAgainstTwoMandatory() { + void testNoneAgainstTwoMandatory() { // one mandatory and one not mandatory List formals = new ArrayList(); NamedFormalParameter mandatoryParam1 = new NamedFormalParameter(NAME_1, intType); @@ -305,13 +305,13 @@ public void testNoneAgainstTwoMandatory() { List actuals = new ArrayList(); ParameterListMatchResult matchResult = parameterListMatcher.match(actuals, formals, parameterMatcher, CASE_INSENSITIVE); checkParameterListResult(ParameterListMatchStatus.MISSING_MANDATORY, 0, 0, matchResult); - assertSame(INCORRECT_NO_UNMATCHED_MANDATORY_FORMALS, 2, matchResult.getUnmatchedMandatoryFormalParameters().size()); - assertSame(INCORRECT_UNMATCHED_MANDATORY_FORMAL, mandatoryParam1, matchResult.getUnmatchedMandatoryFormalParameters().get(0)); - assertSame(INCORRECT_UNMATCHED_MANDATORY_FORMAL, mandatoryParam2, matchResult.getUnmatchedMandatoryFormalParameters().get(1)); + assertSame(2, matchResult.getUnmatchedMandatoryFormalParameters().size(), INCORRECT_NO_UNMATCHED_MANDATORY_FORMALS); + assertSame(mandatoryParam1, matchResult.getUnmatchedMandatoryFormalParameters().get(0), INCORRECT_UNMATCHED_MANDATORY_FORMAL); + assertSame(mandatoryParam2, matchResult.getUnmatchedMandatoryFormalParameters().get(1), INCORRECT_UNMATCHED_MANDATORY_FORMAL); } @Test - public void testNoneAgainstTwoMixed() { + void testNoneAgainstTwoMixed() { // one mandatory and one not mandatory List formals = new ArrayList(); NamedFormalParameter mandatoryParam = new NamedFormalParameter(NAME_1, intType); @@ -320,12 +320,12 @@ public void testNoneAgainstTwoMixed() { List actuals = new ArrayList(); ParameterListMatchResult matchResult = parameterListMatcher.match(actuals, formals, parameterMatcher, CASE_INSENSITIVE); checkParameterListResult(ParameterListMatchStatus.MISSING_MANDATORY, 0, 0, matchResult); - assertSame(INCORRECT_NO_UNMATCHED_MANDATORY_FORMALS, 1, matchResult.getUnmatchedMandatoryFormalParameters().size()); - assertSame(INCORRECT_UNMATCHED_MANDATORY_FORMAL, mandatoryParam, matchResult.getUnmatchedMandatoryFormalParameters().get(0)); + assertSame(1, matchResult.getUnmatchedMandatoryFormalParameters().size(), INCORRECT_NO_UNMATCHED_MANDATORY_FORMALS); + assertSame(mandatoryParam, matchResult.getUnmatchedMandatoryFormalParameters().get(0), INCORRECT_UNMATCHED_MANDATORY_FORMAL); } @Test - public void testThreeUnnamedWithOneTypeError() { + void testThreeUnnamedWithOneTypeError() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType)); @@ -343,7 +343,7 @@ public void testThreeUnnamedWithOneTypeError() { } @Test - public void testThreeNamedWithOneTypeError() { + void testThreeNamedWithOneTypeError() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType)); @@ -361,7 +361,7 @@ public void testThreeNamedWithOneTypeError() { } @Test - public void testThreeMixedAgainstThreeMandatory() { + void testThreeMixedAgainstThreeMandatory() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType)); @@ -379,7 +379,7 @@ public void testThreeMixedAgainstThreeMandatory() { } @Test - public void testTwoMixedAgainstThreeMandatory() { + void testTwoMixedAgainstThreeMandatory() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType)); @@ -395,7 +395,7 @@ public void testTwoMixedAgainstThreeMandatory() { } @Test - public void testTwoMixedAgainstThreeWithOptional() { + void testTwoMixedAgainstThreeWithOptional() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType, IS_OPTIONAL, !IS_MULTI)); @@ -411,7 +411,7 @@ public void testTwoMixedAgainstThreeWithOptional() { } @Test - public void testTwoUnnamedAgainstThreeWithOptional() { + void testTwoUnnamedAgainstThreeWithOptional() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType)); @@ -423,7 +423,7 @@ public void testTwoUnnamedAgainstThreeWithOptional() { } @Test - public void testUnnamedTooManyActuals() { + void testUnnamedTooManyActuals() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType)); @@ -442,7 +442,7 @@ public void testUnnamedTooManyActuals() { } @Test - public void testFourUnnamedAgainstTwoWithMulti() { + void testFourUnnamedAgainstTwoWithMulti() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType, IS_MANDATORY, IS_MULTI)); @@ -455,7 +455,7 @@ public void testFourUnnamedAgainstTwoWithMulti() { } @Test - public void testFourNamedAgainstTwoWithMulti() { + void testFourNamedAgainstTwoWithMulti() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType, IS_MANDATORY, IS_MULTI)); @@ -474,7 +474,7 @@ public void testFourNamedAgainstTwoWithMulti() { } @Test - public void testTwoUnNamedAgainstTwoPositional() { + void testTwoUnNamedAgainstTwoPositional() { List formals = new ArrayList(); formals.add(new FormalParameter(intType)); formals.add(new FormalParameter(textType)); @@ -493,7 +493,7 @@ private void check2Successful(final List formals, final List formals = new ArrayList(); formals.add(new FormalParameter(intType)); formals.add(new FormalParameter(textType, IS_MANDATORY, IS_MULTI)); @@ -516,7 +516,7 @@ private void check4Successful(final List formals, final List formals = new ArrayList(); formals.add(new FormalParameter(intType)); formals.add(new FormalParameter(textType, IS_MANDATORY, IS_MULTI)); @@ -535,7 +535,7 @@ public void testFourUnNamedAgainstTwoPositionalwithMultiAndTypeError() { } @Test - public void testNamedAgainstPositional() { + void testNamedAgainstPositional() { List formals = new ArrayList(); formals.add(new FormalParameter(intType)); formals.add(new FormalParameter(textType)); @@ -550,7 +550,7 @@ public void testNamedAgainstPositional() { } @Test - public void testMissingMandatoryAgainstPositional() { + void testMissingMandatoryAgainstPositional() { List formals = new ArrayList(); formals.add(new FormalParameter(intType)); formals.add(new FormalParameter(textType)); @@ -563,7 +563,7 @@ public void testMissingMandatoryAgainstPositional() { } @Test - public void testInvalidActualNull() { + void testInvalidActualNull() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, textType)); @@ -581,7 +581,7 @@ public void testInvalidActualNull() { } @Test - public void testInvalidActualNullWithMulti() { + void testInvalidActualNullWithMulti() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, textType, IS_MANDATORY, IS_MULTI)); @@ -598,7 +598,7 @@ public void testInvalidActualNullWithMulti() { } @Test - public void testInvalidNamedActualNullName() { + void testInvalidNamedActualNullName() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, textType, IS_OPTIONAL, !IS_MULTI)); @@ -609,7 +609,7 @@ public void testInvalidNamedActualNullName() { } @Test - public void testInvalidNamedActualBlankName() { + void testInvalidNamedActualBlankName() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, textType, IS_OPTIONAL, !IS_MULTI)); @@ -628,7 +628,7 @@ private void check2WithNullFormal1(final List formals, fin } @Test - public void testInvalidFormalNull() { + void testInvalidFormalNull() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(null); @@ -646,7 +646,7 @@ public void testInvalidFormalNull() { } @Test - public void testInvalidFormalNullName() { + void testInvalidFormalNullName() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(null, intType)); @@ -664,7 +664,7 @@ public void testInvalidFormalNullName() { } @Test - public void testInvalidActualNullNameInvalidFormalNullName() { + void testInvalidActualNullNameInvalidFormalNullName() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(null, intType)); @@ -682,7 +682,7 @@ public void testInvalidActualNullNameInvalidFormalNullName() { } @Test - public void testDuplicateFormalName() { + void testDuplicateFormalName() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_1, intType, IS_OPTIONAL, !IS_MULTI)); @@ -692,14 +692,14 @@ public void testDuplicateFormalName() { actuals.add(new NamedActualParameter(NAME_3, textType)); ParameterListMatchResult matchResult = parameterListMatcher.match(actuals, formals, parameterMatcher, CASE_INSENSITIVE); checkParameterListResult(ParameterListMatchStatus.DUPLICATE_PARAMETER, 2, 2, matchResult); - assertSame("have one duplicate formal", 1, matchResult.getDuplicateNamedFormals().size()); + assertSame(1, matchResult.getDuplicateNamedFormals().size(), "have one duplicate formal"); List matches = matchResult.getMatches(); checkParameterMatch(IParameterMatchChecker.MatchStatus.MATCH, actuals.get(0), formals.get(0), matches.get(0)); checkParameterMatch(IParameterMatchChecker.MatchStatus.MATCH, actuals.get(1), formals.get(2), matches.get(1)); } @Test - public void testDuplicateNamedActual() { + void testDuplicateNamedActual() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType)); @@ -717,7 +717,7 @@ public void testDuplicateNamedActual() { } @Test - public void testPositionalAfterNamed1() { + void testPositionalAfterNamed1() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType)); @@ -735,7 +735,7 @@ public void testPositionalAfterNamed1() { } @Test - public void testPositionalAfterNamed2() { + void testPositionalAfterNamed2() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, textType)); @@ -759,7 +759,7 @@ public void testPositionalAfterNamed2() { } @Test - public void testNamedMatchesPositional() { + void testNamedMatchesPositional() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType)); @@ -777,7 +777,7 @@ public void testNamedMatchesPositional() { } @Test - public void testNamedFormalAfterUnnamed1() { + void testNamedFormalAfterUnnamed1() { // these are allowed, match named by position. List formals = new ArrayList(); formals.add(new FormalParameter(intType)); @@ -789,7 +789,7 @@ public void testNamedFormalAfterUnnamed1() { } @Test - public void testNamedFormalAfterUnnamed2() { + void testNamedFormalAfterUnnamed2() { // these are allowed, match named by name. List formals = new ArrayList(); formals.add(new FormalParameter(intType)); @@ -801,7 +801,7 @@ public void testNamedFormalAfterUnnamed2() { } @Test - public void testNamedFormalAfterUnnamed3() { + void testNamedFormalAfterUnnamed3() { // these are allowed, match named by name, unnamed and named optional List formals = new ArrayList(); formals.add(new FormalParameter(intType, !IS_MANDATORY, !IS_MULTI)); @@ -819,12 +819,12 @@ private void verifyOneUnnamedFormalAfterNamed(final List formal checkParameterListResult(ParameterListMatchStatus.UNNAMED_FORMAL_AFTER_NAMED, 1, 1, matchResult); List matches = matchResult.getMatches(); checkParameterMatch(IParameterMatchChecker.MatchStatus.MATCH, actuals.get(0), formals.get(0), matches.get(0)); - assertSame(WRONG_NUMBER_OF_UNNAMED_FORMALS_AFTER_NAMED_FORMALS, 1, matchResult.getUnnamedFormalsAfterNamed().size()); - assertSame(UNNAMED_FORMAL_AFTER_NAMED_NOT_LOCATED, unnamedFormal, matchResult.getUnnamedFormalsAfterNamed().get(0)); + assertSame(1, matchResult.getUnnamedFormalsAfterNamed().size(), WRONG_NUMBER_OF_UNNAMED_FORMALS_AFTER_NAMED_FORMALS); + assertSame(unnamedFormal, matchResult.getUnnamedFormalsAfterNamed().get(0), UNNAMED_FORMAL_AFTER_NAMED_NOT_LOCATED); } @Test - public void testUnnamedFormalAfterNamed1() { + void testUnnamedFormalAfterNamed1() { // unnamed is matched by position List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); @@ -840,13 +840,13 @@ public void testUnnamedFormalAfterNamed1() { List matches = matchResult.getMatches(); checkParameterMatch(IParameterMatchChecker.MatchStatus.MATCH, actuals.get(0), formals.get(0), matches.get(0)); checkParameterMatch(IParameterMatchChecker.MatchStatus.MATCH, actuals.get(1), formals.get(1), matches.get(1)); - assertSame(WRONG_NUMBER_OF_UNNAMED_FORMALS_AFTER_NAMED_FORMALS, 2, matchResult.getUnnamedFormalsAfterNamed().size()); - assertSame(UNNAMED_FORMAL_AFTER_NAMED_NOT_LOCATED, unnamedFormal1, matchResult.getUnnamedFormalsAfterNamed().get(0)); - assertSame(UNNAMED_FORMAL_AFTER_NAMED_NOT_LOCATED, unnamedFormal2, matchResult.getUnnamedFormalsAfterNamed().get(1)); + assertSame(2, matchResult.getUnnamedFormalsAfterNamed().size(), WRONG_NUMBER_OF_UNNAMED_FORMALS_AFTER_NAMED_FORMALS); + assertSame(unnamedFormal1, matchResult.getUnnamedFormalsAfterNamed().get(0), UNNAMED_FORMAL_AFTER_NAMED_NOT_LOCATED); + assertSame(unnamedFormal2, matchResult.getUnnamedFormalsAfterNamed().get(1), UNNAMED_FORMAL_AFTER_NAMED_NOT_LOCATED); } @Test - public void testUnnamedFormalAfterNamed2() { + void testUnnamedFormalAfterNamed2() { // unnamed is optional, at end and not matched because fewer formal parameters List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); @@ -858,7 +858,7 @@ public void testUnnamedFormalAfterNamed2() { } @Test - public void testUnnamedFormalAfterNamed3() { + void testUnnamedFormalAfterNamed3() { // unnamed is mandatory, at end and not matched because fewer formal parameters List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); @@ -870,7 +870,7 @@ public void testUnnamedFormalAfterNamed3() { } @Test - public void testUnnamedFormalAfterNamed4() { + void testUnnamedFormalAfterNamed4() { // two unnamed formals after named List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_2, intType)); @@ -884,13 +884,13 @@ public void testUnnamedFormalAfterNamed4() { checkParameterListResult(ParameterListMatchStatus.UNNAMED_FORMAL_AFTER_NAMED, 1, 1, matchResult); List matches = matchResult.getMatches(); checkParameterMatch(IParameterMatchChecker.MatchStatus.MATCH, actuals.get(0), formals.get(0), matches.get(0)); - assertSame(WRONG_NUMBER_OF_UNNAMED_FORMALS_AFTER_NAMED_FORMALS, 2, matchResult.getUnnamedFormalsAfterNamed().size()); - assertSame(UNNAMED_FORMAL_AFTER_NAMED_NOT_LOCATED, unnamedFormal1, matchResult.getUnnamedFormalsAfterNamed().get(0)); - assertSame(UNNAMED_FORMAL_AFTER_NAMED_NOT_LOCATED, unnamedFormal2, matchResult.getUnnamedFormalsAfterNamed().get(1)); + assertSame(2, matchResult.getUnnamedFormalsAfterNamed().size(), WRONG_NUMBER_OF_UNNAMED_FORMALS_AFTER_NAMED_FORMALS); + assertSame(unnamedFormal1, matchResult.getUnnamedFormalsAfterNamed().get(0), UNNAMED_FORMAL_AFTER_NAMED_NOT_LOCATED); + assertSame(unnamedFormal2, matchResult.getUnnamedFormalsAfterNamed().get(1), UNNAMED_FORMAL_AFTER_NAMED_NOT_LOCATED); } @Test - public void testForceMatchByPosition1() { + void testForceMatchByPosition1() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType)); @@ -908,7 +908,7 @@ public void testForceMatchByPosition1() { } @Test - public void testForceMatchByPosition2() { + void testForceMatchByPosition2() { List formals = new ArrayList(); formals.add(new NamedFormalParameter(NAME_1, intType)); formals.add(new NamedFormalParameter(NAME_2, intType)); @@ -926,7 +926,7 @@ public void testForceMatchByPosition2() { } @Test - public void testForceMatchByPosition3() { + void testForceMatchByPosition3() { List formals = new ArrayList(); formals.add(new FormalParameter(intType)); formals.add(new FormalParameter(intType)); diff --git a/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/test/TypeSystemTestSuite.java b/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/test/TypeSystemTestSuite.java index 1f1374b76d..cb9be41d96 100644 --- a/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/test/TypeSystemTestSuite.java +++ b/com.avaloq.tools.ddk.typesystem.test/src/com/avaloq/tools/ddk/typesystem/test/TypeSystemTestSuite.java @@ -10,24 +10,20 @@ *******************************************************************************/ package com.avaloq.tools.ddk.typesystem.test; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -import com.avaloq.tools.ddk.typesystem.AbstractTypeProviderTest; -import com.avaloq.tools.ddk.typesystem.BuiltInTypeModelAccessTest; -import com.avaloq.tools.ddk.typesystem.ParameterListMatcherTest; +import org.junit.platform.suite.api.SelectPackages; +import org.junit.platform.suite.api.Suite; /** - * Empty class serving only as holder for JUnit4 annotations. + * Junit5 version of test suites. does not implement the logic in our DiscerningSuite. */ -@RunWith(Suite.class) -@Suite.SuiteClasses({ +@Suite +@SelectPackages({ // @Format-Off - AbstractTypeProviderTest.class, - ParameterListMatcherTest.class, - BuiltInTypeModelAccessTest.class -// @Format-On + "com.avaloq.tools.ddk.typesystem.AbstractTypeProviderTest", + "com.avaloq.tools.ddk.typesystem.BuiltInTypeModelAccessTest", + "com.avaloq.tools.ddk.typesystem.ParameterListMatcherTest" + // @Format-On }) public class TypeSystemTestSuite {