From c298d16f527ad928ef4e7c69e343aa3bbbcd0e63 Mon Sep 17 00:00:00 2001 From: Stefan Seelmann Date: Mon, 3 May 2021 08:19:08 +0200 Subject: Migrate remaining JUnit 3 and 4 tests --- .../entryeditor/EntryEditorWidgetSorterTest.java | 8 +- .../search/ReturningAttributesWidgetTest.java | 8 +- .../studio/valueeditors/ValueEditorUtilsTest.java | 6 +- plugins/ldapbrowser.core/pom-first.xml | 9 --- .../model/LdapFilterParserErrorTolerantTest.java | 15 +++- .../core/model/LdapFilterParserTest.java | 33 +++++++- .../ldapbrowser/core/model/PasswordTest.java | 20 ++++- .../ldapbrowser/core/model/schema/SchemaPT.java | 50 ------------ .../core/utils/AttributeComparatorTest.java | 13 ++-- plugins/ldifparser/pom-first.xml | 9 --- .../model/lines/LdifAttrValLineTest.java | 11 ++- .../ldifparser/model/lines/LdifDnLineTest.java | 13 +++- .../studio/ldifparser/parser/LdifParserTest.java | 9 ++- .../config/acl/model/OpenLdapAclParserTest.java | 91 +++++++++------------- .../common/ui/dialogs/UnixPermissionsTest.java | 9 ++- .../config/editor/dialogs/PurgeTimeSpanTest.java | 6 +- .../model/overlay/OlcValSortValueParserTest.java | 12 +-- .../config/wrappers/DbIndexWrapperTest.java | 8 +- .../config/wrappers/LimitsWrapperTest.java | 10 +-- .../config/wrappers/SaslSecPropsWrapperTest.java | 10 +-- .../config/wrappers/SizeLimitWrapperTest.java | 8 +- .../openldap/config/wrappers/SsfWrapperTest.java | 8 +- .../config/wrappers/TimeLimitWrapperTest.java | 6 +- .../studio/openldap/syncrepl/IntervalTest.java | 6 +- .../studio/openldap/syncrepl/KeepAliveTest.java | 6 +- .../studio/openldap/syncrepl/ProviderTest.java | 6 +- .../studio/openldap/syncrepl/RetryPairTest.java | 6 +- .../iktek/studio/openldap/syncrepl/RetryTest.java | 8 +- .../openldap/syncrepl/SyncReplParserTest.java | 12 +-- plugins/pom.xml | 31 +++++++- plugins/schemaeditor/pom-first.xml | 9 --- .../model/alias/AliasesStringParserTest.java | 19 ++++- .../model/difference/DifferenceEngineTest.java | 66 +++++++++++++--- .../model/io/OpenLdapSchemaFileExporterTest.java | 9 +-- .../model/parser/TemplateIOTest.java | 52 ++++++++++++- .../msad/InPlaceMsAdObjectGuidValueEditorTest.java | 5 +- .../msad/InPlaceMsAdObjectSidValueEditorTest.java | 12 +-- .../uuid/InPlaceUuidValueEditorTest.java | 28 +++++-- pom.xml | 3 +- 39 files changed, 390 insertions(+), 260 deletions(-) delete mode 100644 plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaPT.java diff --git a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetSorterTest.java b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetSorterTest.java index 59aad892f..c39e9433c 100644 --- a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetSorterTest.java +++ b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetSorterTest.java @@ -22,14 +22,14 @@ package org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor; import static org.hamcrest.CoreMatchers.equalTo; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import org.apache.directory.studio.ldapbrowser.core.model.IAttribute; import org.apache.directory.studio.ldapbrowser.core.model.impl.Attribute; import org.apache.directory.studio.ldapbrowser.core.model.impl.DummyEntry; import org.apache.directory.studio.ldapbrowser.core.model.impl.Value; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** @@ -45,7 +45,7 @@ public class EntryEditorWidgetSorterTest private Value empytValue2; - @Before + @BeforeEach public void setup() { sorter = new EntryEditorWidgetSorter( null ); diff --git a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java index ca63891d7..5fa6e18ae 100644 --- a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java +++ b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java @@ -21,11 +21,11 @@ package org.apache.directory.studio.ldapbrowser.common.widgets.search; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** diff --git a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/valueeditors/ValueEditorUtilsTest.java b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/valueeditors/ValueEditorUtilsTest.java index 275b0b825..bf1656541 100644 --- a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/valueeditors/ValueEditorUtilsTest.java +++ b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/valueeditors/ValueEditorUtilsTest.java @@ -21,12 +21,12 @@ package org.apache.directory.studio.valueeditors; -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.nio.charset.StandardCharsets; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** diff --git a/plugins/ldapbrowser.core/pom-first.xml b/plugins/ldapbrowser.core/pom-first.xml index cece9aba1..bb34e8da9 100644 --- a/plugins/ldapbrowser.core/pom-first.xml +++ b/plugins/ldapbrowser.core/pom-first.xml @@ -32,15 +32,6 @@ bundle - - - junit - junit - ${junit.version} - test - - - diff --git a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserErrorTolerantTest.java b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserErrorTolerantTest.java index efaedd7bf..132b2bd9d 100755 --- a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserErrorTolerantTest.java +++ b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserErrorTolerantTest.java @@ -21,7 +21,11 @@ package org.apache.directory.studio.ldapbrowser.core.model; -import junit.framework.TestCase; +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 org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilter; import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilterComponent; @@ -29,17 +33,19 @@ import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilterItemC import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterParser; import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterToken; +import org.junit.jupiter.api.Test; + /** * Tests the filter parser for error tolerance. * * @author Apache Directory Project */ -public class LdapFilterParserErrorTolerantTest extends TestCase +public class LdapFilterParserErrorTolerantTest { private LdapFilterParser parser = new LdapFilterParser(); - + @Test public void testLpar() { parser.parse( "(" ); //$NON-NLS-1$ @@ -62,6 +68,7 @@ public class LdapFilterParserErrorTolerantTest extends TestCase } + @Test public void testLparAttr() { parser.parse( "(objectClass" ); //$NON-NLS-1$ @@ -94,6 +101,7 @@ public class LdapFilterParserErrorTolerantTest extends TestCase } + @Test public void testLparAttrEquals() { parser.parse( "(objectClass=" ); //$NON-NLS-1$ @@ -132,6 +140,7 @@ public class LdapFilterParserErrorTolerantTest extends TestCase } + @Test public void testLparAttrEqualsRpar() { parser.parse( "(objectClass=)" ); //$NON-NLS-1$ diff --git a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserTest.java b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserTest.java index 23f551f4a..897f6dcfb 100644 --- a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserTest.java +++ b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserTest.java @@ -21,17 +21,21 @@ package org.apache.directory.studio.ldapbrowser.core.model; -import junit.framework.TestCase; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterParser; +import org.junit.jupiter.api.Test; + /** * Tests the filter parser. * * @author Apache Directory Project */ -public class LdapFilterParserTest extends TestCase +public class LdapFilterParserTest { private LdapFilterParser parser = new LdapFilterParser(); @@ -39,6 +43,7 @@ public class LdapFilterParserTest extends TestCase /** * Tests an equals filter */ + @Test public void testEqualsFilter() { parser.parse( "(cn=test)" ); //$NON-NLS-1$ @@ -51,6 +56,7 @@ public class LdapFilterParserTest extends TestCase /** * Tests an greater equals filter */ + @Test public void testGreaterEqualsFilter() { parser.parse( "(cn>=test)" ); //$NON-NLS-1$ @@ -63,6 +69,7 @@ public class LdapFilterParserTest extends TestCase /** * Tests an less equals filter */ + @Test public void testLessEqualsFilter() { parser.parse( "(cn<=test)" ); //$NON-NLS-1$ @@ -75,6 +82,7 @@ public class LdapFilterParserTest extends TestCase /** * Tests an aprox filter */ + @Test public void testAproxFilter() { parser.parse( "(cn~=test)" ); //$NON-NLS-1$ @@ -87,6 +95,7 @@ public class LdapFilterParserTest extends TestCase /** * Tests an substring filter */ + @Test public void testSubstringFilter() { parser.parse( "(cn=te*st)" ); //$NON-NLS-1$ @@ -99,6 +108,7 @@ public class LdapFilterParserTest extends TestCase /** * Tests an present filter */ + @Test public void testPresentFilter() { parser.parse( "(cn=*)" ); //$NON-NLS-1$ @@ -111,6 +121,7 @@ public class LdapFilterParserTest extends TestCase /** * Tests an simple filter */ + @Test public void testRFC4515_1() { parser.parse( "(cn=Babs Jensen)" ); //$NON-NLS-1$ @@ -123,6 +134,7 @@ public class LdapFilterParserTest extends TestCase /** * Tests an not filter */ + @Test public void testRFC4515_2() { parser.parse( "(!(cn=Tim Howes))" ); //$NON-NLS-1$ @@ -135,6 +147,7 @@ public class LdapFilterParserTest extends TestCase /** * Tests an and/or filter */ + @Test public void testRFC4515_3() { parser.parse( "(&(objectClass=Person)(|(sn=Jensen)(cn=Babs J*)))" ); //$NON-NLS-1$ @@ -147,6 +160,7 @@ public class LdapFilterParserTest extends TestCase /** * Tests an substring filter */ + @Test public void testRFC4515_4() { parser.parse( "(o=univ*of*mich*)" ); //$NON-NLS-1$ @@ -159,6 +173,7 @@ public class LdapFilterParserTest extends TestCase /** * Tests an empty assertion value */ + @Test public void testRFC4515_5() { parser.parse( "(seeAlso=)" ); //$NON-NLS-1$ @@ -175,6 +190,7 @@ public class LdapFilterParserTest extends TestCase * The first example shows the use of the escaping mechanism to * represent parenthesis characters. */ + @Test public void testEscapeRFC4515_1() { parser.parse( "(o=Parens R Us \\28for all your parenthetical needs\\29)" ); //$NON-NLS-1$ @@ -193,6 +209,7 @@ public class LdapFilterParserTest extends TestCase * a "*" in an assertion value, preventing it from being interpreted as * a substring indicator. */ + @Test public void testEscapeRFC4515_2() { parser.parse( "(cn=*\\2A*)" ); //$NON-NLS-1$ @@ -208,6 +225,7 @@ public class LdapFilterParserTest extends TestCase * From RFC4515: * The third illustrates the escaping of the backslash character. */ + @Test public void testEscapeRFC4515_3() { parser.parse( "(filename=C:\\5cMyFile)" ); //$NON-NLS-1$ @@ -225,6 +243,7 @@ public class LdapFilterParserTest extends TestCase * 00 00 00 04 (hex), illustrating the use of the escaping mechanism to * represent arbitrary data, including NUL characters. */ + @Test public void testEscapeRFC4515_4() { parser.parse( "(bin=\\00\\00\\00\\04)" ); //$NON-NLS-1$ @@ -245,6 +264,7 @@ public class LdapFilterParserTest extends TestCase * SMALL LETTER C WITH CARON (U+010D), LATIN SMALL LETTER I (U+0069), * and LATIN SMALL LETTER C WITH ACUTE (U+0107). */ + @Test public void testEscapeRFC4515_5() { parser.parse( "(sn=Lu\\c4\\8di\\c4\\87)" ); //$NON-NLS-1$ @@ -261,6 +281,7 @@ public class LdapFilterParserTest extends TestCase * The sixth and final example demonstrates assertion of a BER-encoded * value. */ + @Test public void testEscapeRFC4515_6() { parser.parse( "(1.3.6.1.4.1.1466.0=\\04\\02\\48\\69)" ); //$NON-NLS-1$ @@ -276,6 +297,7 @@ public class LdapFilterParserTest extends TestCase * From RFC4515: * The first example shows use of the matching rule "caseExactMatch." */ + @Test public void testExtensibleFilterRFC4515_1() { parser.parse( "(cn:caseExactMatch:=Fred Flintstone)" ); //$NON-NLS-1$ @@ -292,6 +314,7 @@ public class LdapFilterParserTest extends TestCase * The second example demonstrates use of a MatchingRuleAssertion form * without a matchingRule. */ + @Test public void testExtensibleFilterRFC4515_2() { parser.parse( "(cn:=Betty Rubble)" ); //$NON-NLS-1$ @@ -311,6 +334,7 @@ public class LdapFilterParserTest extends TestCase * entry's distinguished name should be considered part of the entry * when evaluating the match (indicated by the use of ":dn"). */ + @Test public void testExtensibleFilterRFC4515_3() { parser.parse( "(sn:dn:2.4.6.8.10:=Barney Rubble)" ); //$NON-NLS-1$ @@ -328,6 +352,7 @@ public class LdapFilterParserTest extends TestCase * components should be considered part of the entry when doing the * match. */ + @Test public void testExtensibleFilterRFC4515_4() { parser.parse( "(o:dn:=Ace Industry)" ); //$NON-NLS-1$ @@ -345,6 +370,7 @@ public class LdapFilterParserTest extends TestCase * supporting the matching rule given (since the <attr> has been * omitted). */ + @Test public void testExtensibleFilterRFC4515_5() { parser.parse( "(:1.2.3:=Wilma Flintstone)" ); //$NON-NLS-1$ @@ -363,6 +389,7 @@ public class LdapFilterParserTest extends TestCase * supporting the matching rule contained in the Dn should also be * considered. */ + @Test public void testExtensibleFilterRFC4515_6() { parser.parse( "(:Dn:2.4.6.8.10:=Dino)" ); //$NON-NLS-1$ @@ -375,6 +402,7 @@ public class LdapFilterParserTest extends TestCase /** * Test for DIRSTUIO-210. */ + @Test public void testDIRSTUDIO210() { parser.parse( "(objectClass>=z*) " ); //$NON-NLS-1$ @@ -387,6 +415,7 @@ public class LdapFilterParserTest extends TestCase /** * Test for DIRSTUIO-279. */ + @Test public void testDIRSTUDIO279() { parser.parse( " (&\n (objectClass=person)\n (cn=a*)\n) " ); //$NON-NLS-1$ diff --git a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java index 13f94a1eb..2e6522f38 100644 --- a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java +++ b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java @@ -21,7 +21,11 @@ package org.apache.directory.studio.ldapbrowser.core.model; -import junit.framework.TestCase; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + +import org.junit.jupiter.api.Test; /** @@ -29,11 +33,12 @@ import junit.framework.TestCase; * * @author Apache Directory Project */ -public class PasswordTest extends TestCase +public class PasswordTest { /** * Null Password should not be accepted */ + @Test public void testNullPassword() { try @@ -51,6 +56,7 @@ public class PasswordTest extends TestCase /** * */ + @Test public void testPasswordSHAEncrypted() { Password password = new Password( "{SHA}5en6G6MezRroT3XKqkdPOmY/BfQ=" ); //$NON-NLS-1$ @@ -62,6 +68,7 @@ public class PasswordTest extends TestCase /** * */ + @Test public void testPasswordSHAEncryptedLowercase() { Password password = new Password( "{sha}5en6G6MezRroT3XKqkdPOmY/BfQ=" ); //$NON-NLS-1$ @@ -73,6 +80,7 @@ public class PasswordTest extends TestCase /** * */ + @Test public void testPasswordSSHAEncrypted() { Password password = new Password( "{SSHA}mjVVxasFkk59wMW4L1Ldt+YCblfhULHs03WW7g==" ); //$NON-NLS-1$ @@ -84,6 +92,7 @@ public class PasswordTest extends TestCase /** * */ + @Test public void testPasswordSSHAEncryptedLowercase() { Password password = new Password( "{ssha}mjVVxasFkk59wMW4L1Ldt+YCblfhULHs03WW7g==" ); //$NON-NLS-1$ @@ -95,6 +104,7 @@ public class PasswordTest extends TestCase /** * */ + @Test public void testPasswordMD5Encrypted() { Password password = new Password( "{MD5}Xr4ilOzQ4PCOq3aQ0qbuaQ==" ); //$NON-NLS-1$ @@ -106,6 +116,7 @@ public class PasswordTest extends TestCase /** * */ + @Test public void testPasswordMD5EncryptedLowercase() { Password password = new Password( "{md5}Xr4ilOzQ4PCOq3aQ0qbuaQ==" ); //$NON-NLS-1$ @@ -117,6 +128,7 @@ public class PasswordTest extends TestCase /** * */ + @Test public void testPasswordSMD5Encrypted() { Password password = new Password( "{SMD5}tQ9wo/VBuKsqBtylMMCcORbnYOJFMyDJ" ); //$NON-NLS-1$ @@ -128,6 +140,7 @@ public class PasswordTest extends TestCase /** * */ + @Test public void testPasswordSMD5EncryptedLowercase() { Password password = new Password( "{smd5}tQ9wo/VBuKsqBtylMMCcORbnYOJFMyDJ" ); //$NON-NLS-1$ @@ -139,6 +152,7 @@ public class PasswordTest extends TestCase /** * */ + @Test public void testPasswordCRYPTEncrypted() { Password password = new Password( "{CRYPT}qFkH8Z1woBlXw" ); //$NON-NLS-1$ @@ -150,6 +164,7 @@ public class PasswordTest extends TestCase /** * */ + @Test public void testPasswordCRYPTEncryptedLowercase() { Password password = new Password( "{crypt}qFkH8Z1woBlXw" ); //$NON-NLS-1$ @@ -161,6 +176,7 @@ public class PasswordTest extends TestCase /** * */ + @Test public void testPasswordBadAlgorithm() { Password password = new Password( "{CRYPTE}qFkH8Z1woBlXw" ); //$NON-NLS-1$ diff --git a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaPT.java b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaPT.java deleted file mode 100644 index ad525da91..000000000 --- a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaPT.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.directory.studio.ldapbrowser.core.model.schema; - - -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; - -import org.junit.Test; - - -/** - * @author Apache Directory Project - */ -public class SchemaPT -{ - - @Test - public void testLoadSchemaFromLdifPerformance() throws Exception - { - Schema schema = null; - for ( int i = 0; i < 100; i++ ) - { - InputStream stream = SchemaPT.class.getResourceAsStream( "/default_schema.ldif" ); - Reader reader = new InputStreamReader( stream ); - schema = new Schema(); - schema.loadFromLdif( reader ); - } - System.out.println( schema.getDn() ); - } - -} diff --git a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/utils/AttributeComparatorTest.java b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/utils/AttributeComparatorTest.java index aab0ece2c..26d17f88b 100644 --- a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/utils/AttributeComparatorTest.java +++ b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/utils/AttributeComparatorTest.java @@ -20,8 +20,8 @@ package org.apache.directory.studio.ldapbrowser.core.utils; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; @@ -38,8 +38,8 @@ import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema; import org.apache.directory.studio.ldifparser.model.container.LdifContentRecord; import org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine; import org.apache.directory.studio.ldifparser.model.lines.LdifDnLine; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class AttributeComparatorTest @@ -63,8 +63,7 @@ public class AttributeComparatorTest private AttributeComparator comparator; - - @Before + @BeforeEach public void setup() throws Exception { ConnectionEventRegistry.suspendEventFiringInCurrentThread(); @@ -139,10 +138,10 @@ public class AttributeComparatorTest assertEquals( 0, less + greater ); } - // TODO: objectclass, may, operational // TODO: objectclass < must < may < operational + @Test public void testValuesDiffer() { diff --git a/plugins/ldifparser/pom-first.xml b/plugins/ldifparser/pom-first.xml index 5e1885ba5..70e0ed53a 100644 --- a/plugins/ldifparser/pom-first.xml +++ b/plugins/ldifparser/pom-first.xml @@ -32,15 +32,6 @@ bundle - - - junit - junit - ${junit.version} - test - - - diff --git a/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLineTest.java b/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLineTest.java index 2cedf49a5..06b229f83 100644 --- a/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLineTest.java +++ b/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLineTest.java @@ -21,14 +21,17 @@ package org.apache.directory.studio.ldifparser.model.lines; -import junit.framework.TestCase; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.apache.directory.studio.ldifparser.LdifFormatParameters; +import org.junit.jupiter.api.Test; -public class LdifAttrValLineTest extends TestCase + +public class LdifAttrValLineTest { + @Test public void testToFormattedStringSimple() { LdifAttrValLine line = LdifAttrValLine.create( "cn", "abc" ); //$NON-NLS-1$ //$NON-NLS-2$ @@ -38,6 +41,7 @@ public class LdifAttrValLineTest extends TestCase } + @Test public void testToFormattedStringLineWrap() { LdifAttrValLine line = LdifAttrValLine.create( "cn", //$NON-NLS-1$ @@ -49,6 +53,7 @@ public class LdifAttrValLineTest extends TestCase } + @Test public void testToFormattedStringNoSpaceAfterColon() { LdifAttrValLine line = LdifAttrValLine.create( "cn", "abc" ); //$NON-NLS-1$ //$NON-NLS-2$ @@ -58,6 +63,7 @@ public class LdifAttrValLineTest extends TestCase } + @Test public void testToFormattedStringBase64() { LdifAttrValLine line = LdifAttrValLine.create( "cn", "\u00e4\u00f6\u00fc" ); //$NON-NLS-1$ //$NON-NLS-2$ @@ -67,6 +73,7 @@ public class LdifAttrValLineTest extends TestCase } + @Test public void testToFormattedString_DIRSERVER_285() { LdifAttrValLine line = LdifAttrValLine.create( "cn", "abc::def: parser.parse( "" )); /** * @author Apache Directory Project */ public class OpenLdapAclParserTest { - @Test( expected = ParseException.class ) + @Test public void testEmpty() throws Exception { System.out.println( "\n--> testEmpty" ); OpenLdapAclParser parser = new OpenLdapAclParser(); - parser.parse( "" ); - - fail(); + assertThrows(ParseException.class, () -> parser.parse( "" )); } @@ -134,14 +133,12 @@ public class OpenLdapAclParserTest } - @Test( expected = ParseException.class ) + @Test public void testWhatTwoStars() throws Exception { System.out.println( "\n--> testWhatTwoStars" ); OpenLdapAclParser parser = new OpenLdapAclParser(); - parser.parse( "to * * by *" ); - - fail(); + assertThrows(ParseException.class, () -> parser.parse( "to * * by *" )); } @@ -172,7 +169,7 @@ public class OpenLdapAclParserTest } - @Test( expected = ParseException.class ) + @Test public void testWhatDnStar() throws Exception { System.out.println( "\n--> testWhatDnStar" ); @@ -180,13 +177,11 @@ public class OpenLdapAclParserTest OpenLdapAclParser parser = new OpenLdapAclParser(); // Testing the ACL item - parser.parse( "access to dn=* by *" ); - - fail(); + assertThrows(ParseException.class, () -> parser.parse( "access to dn=* by *" )); } - @Test( expected=ParseException.class) + @Test public void testWhatDnValidDnNoQuote() throws Exception { System.out.println( "\n--> testWhatDnValidDnNoQuote" ); @@ -196,13 +191,11 @@ public class OpenLdapAclParserTest OpenLdapAclParser parser = new OpenLdapAclParser(); // Testing the ACL item - parser.parse( "access to dn=" + dnPattern + "\n by *" ); - - fail(); + assertThrows(ParseException.class, () -> parser.parse( "access to dn=" + dnPattern + "\n by *" )); } - @Ignore - @Test ( expected=ParseException.class) + @Disabled + @Test public void testWhatDnBadDn() throws Exception { System.out.println( "\n--> testWhatDnBadDn" ); @@ -212,9 +205,7 @@ public class OpenLdapAclParserTest OpenLdapAclParser parser = new OpenLdapAclParser(); // Testing the ACL item - parser.parse( "access to dn=\"" + dnPattern + "\"\n by *" ); - - fail(); + assertThrows(ParseException.class, () -> parser.parse( "access to dn=\"" + dnPattern + "\"\n by *" )); } @@ -248,7 +239,7 @@ public class OpenLdapAclParserTest } - @Test ( expected=ParseException.class) + @Test public void testWhatDnBasicDnExactNoQuote() throws Exception { System.out.println( "\n--> testWhatDnBasicDnExactNoQuote" ); @@ -258,13 +249,11 @@ public class OpenLdapAclParserTest OpenLdapAclParser parser = new OpenLdapAclParser(); // Testing the ACL item - parser.parse( "access to dn.exact=" + dnPattern + " by *" ); - - fail(); + assertThrows(ParseException.class, () -> parser.parse( "access to dn.exact=" + dnPattern + " by *" )); } - @Test ( expected=ParseException.class) + @Test public void testWhatDnBasicDnExactBadDn() throws Exception { System.out.println( "\n--> testWhatDnBasicDnExactBadDn" ); @@ -274,9 +263,7 @@ public class OpenLdapAclParserTest OpenLdapAclParser parser = new OpenLdapAclParser(); // Testing the ACL item - parser.parse( "access to dn.exact=" + dnPattern + " by *" ); - - fail(); + assertThrows(ParseException.class, () -> parser.parse( "access to dn.exact=" + dnPattern + " by *" )); } @@ -310,7 +297,7 @@ public class OpenLdapAclParserTest } - @Test( expected=ParseException.class) + @Test public void testWhatDnBasicDnRegexNoQuote() throws Exception { System.out.println( "\n--> testWhatDnBasicDnRegexNoQuote" ); @@ -320,9 +307,7 @@ public class OpenLdapAclParserTest OpenLdapAclParser parser = new OpenLdapAclParser(); // Testing the ACL item - AclItem aclItem = parser.parse( "access to dn.regex=" + dnPattern + " by *" ); - - fail(); + assertThrows(ParseException.class, () -> parser.parse( "access to dn.regex=" + dnPattern + " by *" )); } @@ -544,7 +529,7 @@ public class OpenLdapAclParserTest } - @Test( expected=ParseException.class) + @Test public void testWhatDnScopeOneNoQuotedDn() throws Exception { System.out.println( "\n--> testWhatDnScopeOneNoQuotedDn" ); @@ -554,11 +539,11 @@ public class OpenLdapAclParserTest OpenLdapAclParser parser = new OpenLdapAclParser(); // Testing the ACL item - parser.parse( "access to dn.one=" + dnPattern + " by *" ); + assertThrows(ParseException.class, () -> parser.parse( "access to dn.one=" + dnPattern + " by *" )); } - @Test( expected=ParseException.class) + @Test public void testWhatDnScopeOneNoDn() throws Exception { System.out.println( "\n--> testWhatDnScopeOneNoDn" ); @@ -567,11 +552,11 @@ public class OpenLdapAclParserTest OpenLdapAclParser parser = new OpenLdapAclParser(); // Testing the ACL item - parser.parse( "access to dn.one= by *" ); + assertThrows(ParseException.class, () -> parser.parse( "access to dn.one= by *" )); } - @Test( expected=ParseException.class) + @Test public void testWhatDnScopeOneStar() throws Exception { System.out.println( "\n--> testWhatDnScopeOneStar" ); @@ -580,7 +565,7 @@ public class OpenLdapAclParserTest OpenLdapAclParser parser = new OpenLdapAclParser(); // Testing the ACL item - parser.parse( "access to dn.one=* by *" ); + assertThrows(ParseException.class, () -> parser.parse( "access to dn.one=* by *" )); } @@ -641,7 +626,7 @@ public class OpenLdapAclParserTest } - @Test( expected=ParseException.class) + @Test public void testWhatFilterWrongSimple() throws Exception { System.out.println( "\n--> testWhatFilterWrongSimple" ); @@ -651,15 +636,13 @@ public class OpenLdapAclParserTest OpenLdapAclParser parser = new OpenLdapAclParser(); // Testing the ACL item - parser.parse( "access to filter=" + filter + " by *" ); - - fail(); + assertThrows(ParseException.class, () -> parser.parse( "access to filter=" + filter + " by *" )); } - @Ignore + @Disabled @Test public void testFail() throws Exception { @@ -3853,7 +3836,7 @@ public class OpenLdapAclParserTest @Test - @Ignore + @Disabled public void testWhoAccessLevelSelfPrivMinusMWRSCX() throws Exception { // Create parser diff --git a/plugins/openldap.common.ui/src/test/java/org/apache/directory/studio/openldap/common/ui/dialogs/UnixPermissionsTest.java b/plugins/openldap.common.ui/src/test/java/org/apache/directory/studio/openldap/common/ui/dialogs/UnixPermissionsTest.java index d0fe1ff69..c1cc03979 100644 --- a/plugins/openldap.common.ui/src/test/java/org/apache/directory/studio/openldap/common/ui/dialogs/UnixPermissionsTest.java +++ b/plugins/openldap.common.ui/src/test/java/org/apache/directory/studio/openldap/common/ui/dialogs/UnixPermissionsTest.java @@ -20,12 +20,13 @@ package org.apache.directory.studio.openldap.common.ui.dialogs; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + import org.apache.directory.studio.openldap.common.ui.model.UnixPermissions; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class UnixPermissionsTest diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/editor/dialogs/PurgeTimeSpanTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/editor/dialogs/PurgeTimeSpanTest.java index 4363d0a53..a14ac792e 100644 --- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/editor/dialogs/PurgeTimeSpanTest.java +++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/editor/dialogs/PurgeTimeSpanTest.java @@ -20,12 +20,12 @@ package org.apache.directory.studio.openldap.config.editor.dialogs; -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.text.ParseException; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/model/overlay/OlcValSortValueParserTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/model/overlay/OlcValSortValueParserTest.java index 515e6ed96..45f368528 100644 --- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/model/overlay/OlcValSortValueParserTest.java +++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/model/overlay/OlcValSortValueParserTest.java @@ -20,14 +20,14 @@ package org.apache.directory.studio.openldap.config.model.overlay; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertFalse; -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.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.apache.directory.api.ldap.model.name.Dn; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/DbIndexWrapperTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/DbIndexWrapperTest.java index 125269b28..beb4a0e4a 100644 --- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/DbIndexWrapperTest.java +++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/DbIndexWrapperTest.java @@ -19,13 +19,13 @@ */ package org.apache.directory.studio.openldap.config.wrappers; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.apache.directory.studio.openldap.config.editor.wrappers.DbIndexWrapper; import org.apache.directory.studio.openldap.common.ui.model.DbIndexTypeEnum; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * A test for the DbIndexWrapper class diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/LimitsWrapperTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/LimitsWrapperTest.java index c871cbb6f..8edbaafda 100644 --- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/LimitsWrapperTest.java +++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/LimitsWrapperTest.java @@ -19,10 +19,10 @@ */ package org.apache.directory.studio.openldap.config.wrappers; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.apache.directory.studio.openldap.common.ui.model.DnSpecStyleEnum; import org.apache.directory.studio.openldap.common.ui.model.DnSpecTypeEnum; @@ -31,7 +31,7 @@ import org.apache.directory.studio.openldap.config.editor.wrappers.LimitWrapper; import org.apache.directory.studio.openldap.config.editor.wrappers.LimitsWrapper; import org.apache.directory.studio.openldap.config.editor.wrappers.TimeLimitWrapper; import org.apache.directory.studio.openldap.config.editor.wrappers.SizeLimitWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; /** diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SaslSecPropsWrapperTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SaslSecPropsWrapperTest.java index 216275999..55c4a5e6a 100644 --- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SaslSecPropsWrapperTest.java +++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SaslSecPropsWrapperTest.java @@ -19,14 +19,14 @@ */ package org.apache.directory.studio.openldap.config.wrappers; -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.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 org.apache.directory.studio.openldap.common.ui.model.SaslSecPropEnum; import org.apache.directory.studio.openldap.config.editor.wrappers.SaslSecPropsWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * A test for the SaslSecPropsWrapper class diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SizeLimitWrapperTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SizeLimitWrapperTest.java index 67fa599ff..de51e80c8 100644 --- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SizeLimitWrapperTest.java +++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SizeLimitWrapperTest.java @@ -19,12 +19,12 @@ */ package org.apache.directory.studio.openldap.config.wrappers; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.apache.directory.studio.openldap.config.editor.wrappers.SizeLimitWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * A test for the SizeLimitWrapper class diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SsfWrapperTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SsfWrapperTest.java index 64333abb9..85689d70e 100644 --- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SsfWrapperTest.java +++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SsfWrapperTest.java @@ -19,13 +19,13 @@ */ package org.apache.directory.studio.openldap.config.wrappers; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.apache.directory.studio.openldap.common.ui.model.SsfFeatureEnum; import org.apache.directory.studio.openldap.config.editor.wrappers.SsfWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * A test for the SsfWrapper class diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java index 1910ec3af..ce0e2dfbe 100644 --- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java +++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java @@ -19,11 +19,11 @@ */ package org.apache.directory.studio.openldap.config.wrappers; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.apache.directory.studio.openldap.config.editor.wrappers.TimeLimitWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * A test for the TimeLimitWrapper class diff --git a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/IntervalTest.java b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/IntervalTest.java index 90c16def5..4da9d453d 100644 --- a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/IntervalTest.java +++ b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/IntervalTest.java @@ -20,10 +20,10 @@ package org.apache.directory.studio.openldap.syncrepl; -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 org.junit.Test; +import org.junit.jupiter.api.Test; /** diff --git a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/KeepAliveTest.java b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/KeepAliveTest.java index 69d78d6ec..b0e011552 100644 --- a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/KeepAliveTest.java +++ b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/KeepAliveTest.java @@ -20,10 +20,10 @@ package org.apache.directory.studio.openldap.syncrepl; -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 org.junit.Test; +import org.junit.jupiter.api.Test; /** diff --git a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/ProviderTest.java b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/ProviderTest.java index 220f732ee..c2e6cde51 100644 --- a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/ProviderTest.java +++ b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/ProviderTest.java @@ -20,10 +20,10 @@ package org.apache.directory.studio.openldap.syncrepl; -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 org.junit.Test; +import org.junit.jupiter.api.Test; /** diff --git a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryPairTest.java b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryPairTest.java index 7ab713552..4ab030ff9 100644 --- a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryPairTest.java +++ b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryPairTest.java @@ -20,10 +20,10 @@ package org.apache.directory.studio.openldap.syncrepl; -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 org.junit.Test; +import org.junit.jupiter.api.Test; /** diff --git a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryTest.java b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryTest.java index 8cf9c9170..ebbf1105a 100644 --- a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryTest.java +++ b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryTest.java @@ -20,11 +20,11 @@ package org.apache.directory.studio.openldap.syncrepl; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** diff --git a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/SyncReplParserTest.java b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/SyncReplParserTest.java index 36c1ebb5f..ac99ff35a 100644 --- a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/SyncReplParserTest.java +++ b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/SyncReplParserTest.java @@ -20,13 +20,13 @@ package org.apache.directory.studio.openldap.syncrepl; -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.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 org.junit.Test; +import org.junit.jupiter.api.Test; /** diff --git a/plugins/pom.xml b/plugins/pom.xml index 2eee71664..575f92970 100644 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -144,11 +144,34 @@ - junit - junit - ${junit.version} + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + test + + + org.junit.jupiter + junit-jupiter + ${junit.jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-engine + ${junit.jupiter.version} + test + + + org.junit.platform + junit-platform-runner + ${junit.platform.version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit.jupiter.version} test - diff --git a/plugins/schemaeditor/pom-first.xml b/plugins/schemaeditor/pom-first.xml index d32627b34..c4170c39e 100644 --- a/plugins/schemaeditor/pom-first.xml +++ b/plugins/schemaeditor/pom-first.xml @@ -32,15 +32,6 @@ bundle - - - junit - junit - ${junit.version} - test - - - diff --git a/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/alias/AliasesStringParserTest.java b/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/alias/AliasesStringParserTest.java index f79cc9386..69066fa32 100644 --- a/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/alias/AliasesStringParserTest.java +++ b/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/alias/AliasesStringParserTest.java @@ -20,9 +20,11 @@ package org.apache.directory.studio.schemaeditor.model.alias; +import static org.junit.jupiter.api.Assertions.assertEquals; + import java.util.List; -import junit.framework.TestCase; +import org.junit.jupiter.api.Test; /** @@ -30,8 +32,9 @@ import junit.framework.TestCase; * * @author Apache Directory Project */ -public class AliasesStringParserTest extends TestCase +public class AliasesStringParserTest { + @Test public void testNoAlias() throws Exception { AliasesStringParser parser = new AliasesStringParser(); @@ -42,6 +45,7 @@ public class AliasesStringParserTest extends TestCase } + @Test public void testOneAlias() throws Exception { AliasesStringParser parser = new AliasesStringParser(); @@ -53,6 +57,7 @@ public class AliasesStringParserTest extends TestCase } + @Test public void testTwoAliases() throws Exception { AliasesStringParser parser = new AliasesStringParser(); @@ -65,6 +70,7 @@ public class AliasesStringParserTest extends TestCase } + @Test public void testThreeAliases() throws Exception { AliasesStringParser parser = new AliasesStringParser(); @@ -78,6 +84,7 @@ public class AliasesStringParserTest extends TestCase } + @Test public void testMultipleCommasNoAlias() throws Exception { AliasesStringParser parser = new AliasesStringParser(); @@ -88,6 +95,7 @@ public class AliasesStringParserTest extends TestCase } + @Test public void testMultipleCommasAndWhiteSpacesNoAlias() throws Exception { AliasesStringParser parser = new AliasesStringParser(); @@ -98,6 +106,7 @@ public class AliasesStringParserTest extends TestCase } + @Test public void testTwoAliasesMultipleCommas() throws Exception { AliasesStringParser parser = new AliasesStringParser(); @@ -110,6 +119,7 @@ public class AliasesStringParserTest extends TestCase } + @Test public void testOneAliasWithStartError() throws Exception { AliasesStringParser parser = new AliasesStringParser(); @@ -122,6 +132,7 @@ public class AliasesStringParserTest extends TestCase } + @Test public void testOneAliasWithStartError2() throws Exception { AliasesStringParser parser = new AliasesStringParser(); @@ -134,6 +145,7 @@ public class AliasesStringParserTest extends TestCase } + @Test public void testOneAliasWithPartError() throws Exception { AliasesStringParser parser = new AliasesStringParser(); @@ -146,6 +158,7 @@ public class AliasesStringParserTest extends TestCase } + @Test public void testOneAliasWithPartError2() throws Exception { AliasesStringParser parser = new AliasesStringParser(); @@ -158,6 +171,7 @@ public class AliasesStringParserTest extends TestCase } + @Test public void testOneAliasWithPartErrorAndOneAliasWithStartError() throws Exception { AliasesStringParser parser = new AliasesStringParser(); @@ -172,6 +186,7 @@ public class AliasesStringParserTest extends TestCase } + @Test public void testOneAliasWithPartErrorAndOneAliasWithStartError2() throws Exception { AliasesStringParser parser = new AliasesStringParser(); diff --git a/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/difference/DifferenceEngineTest.java b/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/difference/DifferenceEngineTest.java index 1988468da..d4365c16b 100644 --- a/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/difference/DifferenceEngineTest.java +++ b/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/difference/DifferenceEngineTest.java @@ -20,29 +20,34 @@ package org.apache.directory.studio.schemaeditor.model.difference; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.fail; + import java.util.Arrays; import java.util.List; -import junit.framework.TestCase; - import org.apache.directory.api.ldap.model.schema.AttributeType; import org.apache.directory.api.ldap.model.schema.ObjectClass; import org.apache.directory.api.ldap.model.schema.ObjectClassTypeEnum; import org.apache.directory.api.ldap.model.schema.UsageEnum; +import org.junit.jupiter.api.Test; + /** * This class tests the DifferenceEngine class. * * @author Apache Directory Project */ -public class DifferenceEngineTest extends TestCase +public class DifferenceEngineTest { /** * Tests the AddAliasDifference. * * @throws Exception */ + @Test public void testAddAliasDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -70,6 +75,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testAddDescriptionDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -97,6 +103,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testAddEqualityDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -123,6 +130,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testAddMandatoryATDifference() throws Exception { ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$ @@ -151,6 +159,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testAddOptionalATDifference() throws Exception { ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$ @@ -164,7 +173,8 @@ public class DifferenceEngineTest extends TestCase Difference difference = differences.get( 0 ); - if ( !( difference instanceof OptionalATDifference ) || ( !difference.getType().equals( DifferenceType.ADDED ) ) ) + if ( !( difference instanceof OptionalATDifference ) + || ( !difference.getType().equals( DifferenceType.ADDED ) ) ) { fail(); } @@ -178,6 +188,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testAddOrderingDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -204,6 +215,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testAddSubstringDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -216,7 +228,8 @@ public class DifferenceEngineTest extends TestCase Difference difference = differences.get( 0 ); - if ( !( difference instanceof SubstringDifference ) || ( !difference.getType().equals( DifferenceType.ADDED ) ) ) + if ( !( difference instanceof SubstringDifference ) + || ( !difference.getType().equals( DifferenceType.ADDED ) ) ) { fail(); } @@ -230,6 +243,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testAddSuperiorATDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -242,7 +256,8 @@ public class DifferenceEngineTest extends TestCase Difference difference = differences.get( 0 ); - if ( !( difference instanceof SuperiorATDifference ) || ( !difference.getType().equals( DifferenceType.ADDED ) ) ) + if ( !( difference instanceof SuperiorATDifference ) + || ( !difference.getType().equals( DifferenceType.ADDED ) ) ) { fail(); } @@ -256,6 +271,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testAddSuperiorOCDifference() throws Exception { ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$ @@ -269,7 +285,8 @@ public class DifferenceEngineTest extends TestCase Difference difference = differences.get( 0 ); - if ( !( difference instanceof SuperiorOCDifference ) || ( !difference.getType().equals( DifferenceType.ADDED ) ) ) + if ( !( difference instanceof SuperiorOCDifference ) + || ( !difference.getType().equals( DifferenceType.ADDED ) ) ) { fail(); } @@ -283,6 +300,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testAddSyntaxDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -309,6 +327,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testAddSyntaxLengthDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -336,6 +355,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testModifyClassTypeDifference() throws Exception { ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$ @@ -365,6 +385,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testModifyCollectiveDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -394,6 +415,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testModifyDescriptionDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -423,6 +445,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testModifyEqualityDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -452,6 +475,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testModifyNoUserModificationDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -481,6 +505,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testModifyObsoleteDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -510,6 +535,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testModifyOrderingDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -539,6 +565,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testModifySingleValueDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -568,6 +595,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testModifySubstringDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -597,6 +625,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testModifySuperiorATDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -626,6 +655,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testModifySyntaxDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -639,7 +669,8 @@ public class DifferenceEngineTest extends TestCase Difference difference = differences.get( 0 ); - if ( !( difference instanceof SyntaxDifference ) || ( !difference.getType().equals( DifferenceType.MODIFIED ) ) ) + if ( !( difference instanceof SyntaxDifference ) + || ( !difference.getType().equals( DifferenceType.MODIFIED ) ) ) { fail(); } @@ -654,6 +685,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testModifySyntaxLengthDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -683,6 +715,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testModifyUsageDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -711,6 +744,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testRemoveAliasDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -741,6 +775,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testRemoveDescriptionDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -769,6 +804,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testRemoveEqualityDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -781,7 +817,8 @@ public class DifferenceEngineTest extends TestCase Difference difference = differences.get( 0 ); - if ( !( difference instanceof EqualityDifference ) || ( !difference.getType().equals( DifferenceType.REMOVED ) ) ) + if ( !( difference instanceof EqualityDifference ) + || ( !difference.getType().equals( DifferenceType.REMOVED ) ) ) { fail(); } @@ -796,6 +833,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testRemoveMandatoryATDifference() throws Exception { ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$ @@ -827,6 +865,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testRemoveOptionalATDifference() throws Exception { ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$ @@ -858,6 +897,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testRemoveOrderingDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -870,7 +910,8 @@ public class DifferenceEngineTest extends TestCase Difference difference = differences.get( 0 ); - if ( !( difference instanceof OrderingDifference ) || ( !difference.getType().equals( DifferenceType.REMOVED ) ) ) + if ( !( difference instanceof OrderingDifference ) + || ( !difference.getType().equals( DifferenceType.REMOVED ) ) ) { fail(); } @@ -885,6 +926,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testRemoveSubstringDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -913,6 +955,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testRemoveSuperiorATDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -941,6 +984,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testRemoveSuperiorOCDifference() throws Exception { ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$ @@ -972,6 +1016,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testRemoveSyntaxDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ @@ -999,6 +1044,7 @@ public class DifferenceEngineTest extends TestCase * * @throws Exception */ + @Test public void testRemoveSyntaxLengthDifference() throws Exception { AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$ diff --git a/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileExporterTest.java b/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileExporterTest.java index 8495a0b37..bd8cc1ff3 100644 --- a/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileExporterTest.java +++ b/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileExporterTest.java @@ -20,7 +20,7 @@ package org.apache.directory.studio.schemaeditor.model.io; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Arrays; import java.util.Collections; @@ -29,9 +29,8 @@ import org.apache.directory.api.ldap.model.schema.AttributeType; import org.apache.directory.api.ldap.model.schema.ObjectClass; import org.apache.directory.api.ldap.model.schema.ObjectClassTypeEnum; import org.apache.directory.api.ldap.model.schema.UsageEnum; -import org.junit.Before; -import org.junit.Test; - +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * @author Apache Directory Project @@ -45,7 +44,7 @@ public class OpenLdapSchemaFileExporterTest private AttributeType attributeTypeSimple; private AttributeType attributeTypeComplex; - @Before + @BeforeEach public void setUp() { objectClassSimple = new ObjectClass( "1.2.3.4" ); diff --git a/plugins/templateeditor/src/test/java/org/apache/directory/studio/templateeditor/model/parser/TemplateIOTest.java b/plugins/templateeditor/src/test/java/org/apache/directory/studio/templateeditor/model/parser/TemplateIOTest.java index fd284ce99..04f1e04d8 100644 --- a/plugins/templateeditor/src/test/java/org/apache/directory/studio/templateeditor/model/parser/TemplateIOTest.java +++ b/plugins/templateeditor/src/test/java/org/apache/directory/studio/templateeditor/model/parser/TemplateIOTest.java @@ -20,7 +20,14 @@ package org.apache.directory.studio.templateeditor.model.parser; -import junit.framework.TestCase; +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 org.junit.jupiter.api.Test; import org.apache.directory.studio.templateeditor.model.FileTemplate; import org.apache.directory.studio.templateeditor.model.parser.TemplateIO; @@ -47,11 +54,12 @@ import org.apache.directory.studio.templateeditor.model.widgets.ValueItem; * * @author Apache Directory Project */ -public class TemplateIOTest extends TestCase +public class TemplateIOTest { /** * Tests the parser with a minimal template file. */ + @Test public void testReadTemplateMinimalTest() { FileTemplate template = null; @@ -92,6 +100,7 @@ public class TemplateIOTest extends TestCase /** * Tests the parser with a minimal template file. */ + @Test public void testReadTemplateMinimalWithCompositeTest() { FileTemplate template = null; @@ -135,6 +144,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a section with a * 'columns' attribute. */ + @Test public void testReadTemplateSectionColumnsAttributeTest() { FileTemplate template = null; @@ -167,6 +177,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a section with a * 'columns' attribute. */ + @Test public void testReadTemplateSectionDescriptionAttributeTest() { FileTemplate template = null; @@ -199,6 +210,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a section with a * 'columns' attribute. */ + @Test public void testReadTemplateSectionTitleAttributeTest() { FileTemplate template = null; @@ -231,6 +243,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a section with a wrong * 'columns' attribute. */ + @Test public void testReadTemplateSectionWrongColumnsAttributeTest() throws Exception { testParsingFail( "template_section_with_wrong_columns_attribute.xml" ); //$NON-NLS-1$ @@ -241,6 +254,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a checkbox with a * value for the 'attributeType' attribute. */ + @Test public void testReadTemplateCheckboxAttributetypeValueTest() { FileTemplate template = null; @@ -282,6 +296,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a checkbox with a * value for the 'checkedValue' attribute. */ + @Test public void testReadTemplateCheckboxCheckedValueTest() { FileTemplate template = null; @@ -323,6 +338,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a checkbox with a * value for the 'uncheckedValue' attribute. */ + @Test public void testReadTemplateCheckboxUncheckedValueTest() { FileTemplate template = null; @@ -364,6 +380,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a checkbox with a * value for the 'uncheckedValue' attribute. */ + @Test public void testReadTemplateCheckboxCheckedAndUnheckedValuesTest() { FileTemplate template = null; @@ -405,6 +422,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a file chooser with * only value for the 'attributeType' attribute. */ + @Test public void testReadTemplateFileChooserAttributeTypeValueTest() { FileTemplate template = null; @@ -448,6 +466,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a file chooser with all * values. */ + @Test public void testReadTemplateFileChooserAllValuesTest() { FileTemplate template = null; @@ -491,6 +510,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing an image with only the * value for the 'attributeType' attribute. */ + @Test public void testReadTemplateImageAttributeTypeValueTest() { FileTemplate template = null; @@ -535,6 +555,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing an image with all * values. */ + @Test public void testReadTemplateImageAllValuesTest() { FileTemplate template = null; @@ -579,6 +600,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a label with only the * value for the 'attributeType' attribute. */ + @Test public void testReadTemplateLabelAttributeTypeValueTest() { FileTemplate template = null; @@ -618,6 +640,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a label with a value * for the 'value' attribute. */ + @Test public void testReadTemplateLabelValueValueTest() { FileTemplate template = null; @@ -657,6 +680,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a link with only the * value for the 'attributeType' attribute. */ + @Test public void testReadTemplateLinkAttributeTypeValueTest() { FileTemplate template = null; @@ -696,6 +720,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a link with a value * for the 'value' attribute. */ + @Test public void testReadTemplateLinkValueValueTest() { FileTemplate template = null; @@ -735,6 +760,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a listbox with the * minimal set of elements and attributes. */ + @Test public void testReadTemplateListboxMinimalTest() { FileTemplate template = null; @@ -777,6 +803,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a listbox with the * minimal set of elements and attributes. */ + @Test public void testReadTemplateListboxSingleSelectionTest() { FileTemplate template = null; @@ -819,6 +846,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a listbox with * multiple items. */ + @Test public void testReadTemplateListboxMultipleItemsTest() { FileTemplate template = null; @@ -863,6 +891,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a password with the * minimal set of elements and attributes. */ + @Test public void testReadTemplatePasswordMinimalTest() { FileTemplate template = null; @@ -903,6 +932,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a password with the * minimal set of elements and attributes. */ + @Test public void testReadTemplatePasswordNotHiddenTest() { FileTemplate template = null; @@ -943,6 +973,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a password with the * minimal set of elements and attributes. */ + @Test public void testReadTemplatePasswordNotShowChangeButtonTest() { FileTemplate template = null; @@ -983,6 +1014,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a radio buttons with * the minimal set of elements and attributes. */ + @Test public void testReadTemplateRadioButtonsMinimalTest() { FileTemplate template = null; @@ -1024,6 +1056,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a radio buttons with * multiple buttons. */ + @Test public void testReadTemplateRadioButtonsMultipleButtonsTest() { FileTemplate template = null; @@ -1067,6 +1100,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a spinner with the * minimal set of elements and attributes. */ + @Test public void testReadTemplateSpinnerMinimalTest() { FileTemplate template = null; @@ -1110,6 +1144,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a spinner with all the * values for its attributes. */ + @Test public void testReadTemplateSpinnerAllValuesTest() { FileTemplate template = null; @@ -1152,6 +1187,7 @@ public class TemplateIOTest extends TestCase /** * Tests the parser with a template file containing a table. */ + @Test public void testReadTemplateTableTest() { FileTemplate template = null; @@ -1189,6 +1225,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a text field with the * minimal set of elements and attributes. */ + @Test public void testReadTemplateTextFieldMinimalTest() { FileTemplate template = null; @@ -1229,6 +1266,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a text field with the * minimal set of elements and attributes. */ + @Test public void testReadTemplateTextFieldAllValuesTest() { FileTemplate template = null; @@ -1268,6 +1306,7 @@ public class TemplateIOTest extends TestCase /** * Tests the parser with a template containing a wrong root element. */ + @Test public void testReadTemplateWrongRootElementTest() throws Exception { testParsingFail( "template_wrong_root_element.xml" ); //$NON-NLS-1$ @@ -1277,6 +1316,7 @@ public class TemplateIOTest extends TestCase /** * Tests the parser with a template containing no 'id' attribute. */ + @Test public void testReadTemplateNoIdAttributeTest() throws Exception { testParsingFail( "template_no_id_attribute.xml" ); //$NON-NLS-1$ @@ -1286,6 +1326,7 @@ public class TemplateIOTest extends TestCase /** * Tests the parser with a template containing no 'title' attribute. */ + @Test public void testReadTemplateNoTitleAttributeTest() throws Exception { testParsingFail( "template_no_title_attribute.xml" ); //$NON-NLS-1$ @@ -1295,6 +1336,7 @@ public class TemplateIOTest extends TestCase /** * Tests the parser with a template containing no 'objectClasses' element. */ + @Test public void testReadTemplateNoObjectClassesElementTest() throws Exception { testParsingFail( "template_no_objectClasses_element.xml" ); //$NON-NLS-1$ @@ -1304,6 +1346,7 @@ public class TemplateIOTest extends TestCase /** * Tests the parser with a template containing no 'structural' element. */ + @Test public void testReadTemplateNoObjectClassElementTest() throws Exception { testParsingFail( "template_no_structural_element.xml" ); //$NON-NLS-1$ @@ -1313,6 +1356,7 @@ public class TemplateIOTest extends TestCase /** * Tests the parser with a template containing no 'form' element. */ + @Test public void testReadTemplateNoFormElementTest() throws Exception { testParsingFail( "template_no_form_element.xml" ); //$NON-NLS-1$ @@ -1322,6 +1366,7 @@ public class TemplateIOTest extends TestCase /** * Tests the parser with a template containing no 'section' element. */ + @Test public void testReadTemplateNoSectionElementTest() throws Exception { testParsingFail( "template_no_section_element.xml" ); //$NON-NLS-1$ @@ -1344,7 +1389,7 @@ public class TemplateIOTest extends TestCase } catch ( TemplateIOException e ) { - assertTrue( e.getMessage(), true ); + assertTrue( true, e.getMessage() ); return; } fail(); @@ -1355,6 +1400,7 @@ public class TemplateIOTest extends TestCase * Tests the parser with a template file containing a section with a * 'columns' attribute. */ + @Test public void testReadTemplateCompositeColumnsAttributeTest() { FileTemplate template = null; diff --git a/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectGuidValueEditorTest.java b/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectGuidValueEditorTest.java index 7bd20c7d6..d6764a9ca 100644 --- a/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectGuidValueEditorTest.java +++ b/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectGuidValueEditorTest.java @@ -21,10 +21,11 @@ package org.apache.directory.studio.valueeditors.msad; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.apache.directory.api.util.Strings; -import org.junit.Test; + +import org.junit.jupiter.api.Test; public class InPlaceMsAdObjectGuidValueEditorTest diff --git a/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectSidValueEditorTest.java b/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectSidValueEditorTest.java index 78f4f813c..e86c5dd53 100644 --- a/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectSidValueEditorTest.java +++ b/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectSidValueEditorTest.java @@ -21,9 +21,9 @@ package org.apache.directory.studio.valueeditors.msad; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class InPlaceMsAdObjectSidValueEditorTest @@ -48,7 +48,7 @@ public class InPlaceMsAdObjectSidValueEditorTest ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00 // - }; + }; String displayValue = editor.convertToString( bytes ); assertEquals( "S-1-5-4", displayValue ); //$NON-NLS-1$ } @@ -77,7 +77,7 @@ public class InPlaceMsAdObjectSidValueEditorTest ( byte ) 0x02, ( byte ) 0x00, ( byte ) 0x00 // - }; + }; String displayValue = editor.convertToString( bytes ); assertEquals( "S-1-5-32-549", displayValue ); //$NON-NLS-1$ } @@ -119,7 +119,7 @@ public class InPlaceMsAdObjectSidValueEditorTest ( byte ) 0x01, ( byte ) 0x00, ( byte ) 0x00 // - }; + }; String displayValue = editor.convertToString( bytes ); assertEquals( "S-1-5-21-666267311-2692216076-1860112551-500", displayValue ); //$NON-NLS-1$ } @@ -206,7 +206,7 @@ public class InPlaceMsAdObjectSidValueEditorTest ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00 // - }; + }; String displayValue3 = editor.convertToString( bytes3 ); assertEquals( Messages.getString( "InPlaceMsAdObjectSidValueEditor.InvalidSid" ), displayValue3 ); //$NON-NLS-1$ } diff --git a/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/uuid/InPlaceUuidValueEditorTest.java b/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/uuid/InPlaceUuidValueEditorTest.java index a31ac1d94..a5ac129de 100644 --- a/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/uuid/InPlaceUuidValueEditorTest.java +++ b/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/uuid/InPlaceUuidValueEditorTest.java @@ -21,10 +21,11 @@ package org.apache.directory.studio.valueeditors.uuid; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.apache.directory.api.util.Strings; -import org.junit.Test; + +import org.junit.jupiter.api.Test; public class InPlaceUuidValueEditorTest @@ -99,9 +100,26 @@ public class InPlaceUuidValueEditorTest // test too long byte[] bytes2 = new byte[] - { ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, - ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, - ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, + { + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, + ( byte ) 0x00, ( byte ) 0x00, }; String displayValue2 = editor.convertToString( bytes2 ); assertEquals( Messages.getString( "InPlaceUuidValueEditor.InvalidUuid" ), displayValue2 ); //$NON-NLS-1$ diff --git a/pom.xml b/pom.xml index 66c642248..cd56d329a 100644 --- a/pom.xml +++ b/pom.xml @@ -74,7 +74,8 @@ 2.7.7 2.7.7 - 4.11 + 1.7.1 + 5.7.1 1.2.17 1.2.17 2.7.0 -- cgit v1.2.3