http://git-wip-us.apache.org/repos/asf/wicket/blob/645f239c/wicket-core/src/test/java/org/apache/wicket/validation/validator/CreditCardValidatorTest.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/validation/validator/CreditCardValidatorTest.java b/wicket-core/src/test/java/org/apache/wicket/validation/validator/CreditCardValidatorTest.java index 3407e49..9ff7d5d 100644 --- a/wicket-core/src/test/java/org/apache/wicket/validation/validator/CreditCardValidatorTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/validation/validator/CreditCardValidatorTest.java @@ -16,24 +16,25 @@ */ package org.apache.wicket.validation.validator; +import static org.junit.jupiter.api.Assertions.assertEquals; + import org.apache.wicket.validation.IValidatable; import org.apache.wicket.validation.Validatable; import org.apache.wicket.validation.validator.CreditCardValidator.CreditCard; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Tests a few valid and invalid credit card numbers. * * @author Joachim F. Rohde */ -public class CreditCardValidatorTest extends Assert +class CreditCardValidatorTest { /** * Tests a couple of credit card numbers that shouldn't be valid. */ @Test - public void invalidCreditCardNumbers() + void invalidCreditCardNumbers() { // null value CreditCardValidator test = new CreditCardValidator(); @@ -67,7 +68,7 @@ public class CreditCardValidatorTest extends Assert * https://www.paypal.com/en_US/vhelp/paypalmanager_help/credit_card_numbers.htm */ @Test - public void validCreditCardNumbers() + void validCreditCardNumbers() { // American Express CreditCardValidator test = new CreditCardValidator(); @@ -151,7 +152,7 @@ public class CreditCardValidatorTest extends Assert * https://issues.apache.org/jira/browse/WICKET-3998 */ @Test - public void isVisa() + void isVisa() { CreditCardValidator validator = new CreditCardValidator(); assertEquals(CreditCard.VISA, validator.determineCardId("4111111111111111")); @@ -161,7 +162,7 @@ public class CreditCardValidatorTest extends Assert * https://issues.apache.org/jira/browse/WICKET-5891 */ @Test - public void isChinaUnionPay() + void isChinaUnionPay() { CreditCardValidator validator = new CreditCardValidator(); CreditCard creditCard = validator.determineCardId("6222601010012578692");
http://git-wip-us.apache.org/repos/asf/wicket/blob/645f239c/wicket-core/src/test/java/org/apache/wicket/validation/validator/EmailValidatorTest.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/validation/validator/EmailValidatorTest.java b/wicket-core/src/test/java/org/apache/wicket/validation/validator/EmailValidatorTest.java index 4ce3c5c..55e353a 100644 --- a/wicket-core/src/test/java/org/apache/wicket/validation/validator/EmailValidatorTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/validation/validator/EmailValidatorTest.java @@ -16,28 +16,30 @@ */ package org.apache.wicket.validation.validator; -import org.junit.Assert; -import org.junit.Test; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; /** * Tests a couple of valid and invalid email patterns. * * @author Maurice Marrink */ -public class EmailValidatorTest extends Assert +class EmailValidatorTest { /** * Tests a couple of emails that should be valid. */ @Test - public void testValidEmails() + void testValidEmails() { EmailAddressValidator test = new EmailAddressValidator(); String[] emails = new String[] { "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]" }; for (String email : emails) { - assertTrue(email + " should be valid", test.getPattern().matcher(email).matches()); + assertTrue(test.getPattern().matcher(email).matches(), email + " should be valid"); } } @@ -45,14 +47,14 @@ public class EmailValidatorTest extends Assert * Tests a couple of emails that should not be valid. */ @Test - public void testInvalidEmails() + void testInvalidEmails() { EmailAddressValidator test = new EmailAddressValidator(); String[] emails = new String[] { "[email protected]", "[email protected]", "blaat@nl", "[email protected]" }; for (String email : emails) { - assertFalse(email + " should not be valid", test.getPattern().matcher(email).matches()); + assertFalse(test.getPattern().matcher(email).matches(), email + " should not be valid"); } } } http://git-wip-us.apache.org/repos/asf/wicket/blob/645f239c/wicket-core/src/test/java/org/apache/wicket/validation/validator/RangeValidatorTest.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/validation/validator/RangeValidatorTest.java b/wicket-core/src/test/java/org/apache/wicket/validation/validator/RangeValidatorTest.java index 3a7408f..71b89b2 100644 --- a/wicket-core/src/test/java/org/apache/wicket/validation/validator/RangeValidatorTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/validation/validator/RangeValidatorTest.java @@ -16,26 +16,26 @@ */ package org.apache.wicket.validation.validator; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.apache.wicket.validation.IValidator; import org.apache.wicket.validation.Validatable; import org.apache.wicket.validation.ValidationError; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Tests range validator * * @author igor.vaynberg */ -public class RangeValidatorTest +class RangeValidatorTest { /** * @throws Exception */ @Test - public void doubleRange() throws Exception + void doubleRange() throws Exception { IValidator<Double> validator = new RangeValidator<Double>(1.1, 1.8); @@ -65,7 +65,7 @@ public class RangeValidatorTest * @throws Exception */ @Test - public void integerRange() throws Exception + void integerRange() throws Exception { IValidator<Integer> validator = new RangeValidator<Integer>(1, 8); @@ -92,7 +92,7 @@ public class RangeValidatorTest } @Test - public void resourceKeys() + void resourceKeys() { Validatable<Integer> validatable = new Validatable<Integer>(10); @@ -118,7 +118,7 @@ public class RangeValidatorTest } @Test - public void onlyMinValue() + void onlyMinValue() { IValidator<Integer> validator = new RangeValidator<Integer>(1, null); @@ -128,7 +128,7 @@ public class RangeValidatorTest } @Test - public void onlyMaxValue() + void onlyMaxValue() { IValidator<Integer> validator = new RangeValidator<Integer>(null, 1); @@ -141,7 +141,7 @@ public class RangeValidatorTest * WICKET-4717 */ @Test - public void exact() + void exact() { IValidator<Integer> validator = new RangeValidator<Integer>(1, 1); http://git-wip-us.apache.org/repos/asf/wicket/blob/645f239c/wicket-core/src/test/java/org/apache/wicket/validation/validator/UrlValidatorTest.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/validation/validator/UrlValidatorTest.java b/wicket-core/src/test/java/org/apache/wicket/validation/validator/UrlValidatorTest.java index 236720a..07e4788 100644 --- a/wicket-core/src/test/java/org/apache/wicket/validation/validator/UrlValidatorTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/validation/validator/UrlValidatorTest.java @@ -16,16 +16,18 @@ */ package org.apache.wicket.validation.validator; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * {@link UrlValidator} test * * @author igor.vaynberg */ -public class UrlValidatorTest extends Assert +class UrlValidatorTest { private final boolean printStatus = false; @@ -37,8 +39,8 @@ public class UrlValidatorTest extends Assert /** * */ - @Before - public void setUp() + @BeforeEach + void setUp() { for (int index = 0; index < testPartsIndex.length - 1; index++) { @@ -50,7 +52,7 @@ public class UrlValidatorTest extends Assert * WICKET-5112 */ @Test - public void testParentheses() + void testParentheses() { String[] schemes = { "http" }; UrlValidator urlValidator = new UrlValidator(schemes); @@ -61,7 +63,7 @@ public class UrlValidatorTest extends Assert * test */ @Test - public void testIsValid() + void testIsValid() { testIsValid(testUrlParts, UrlValidator.ALLOW_ALL_SCHEMES); setUp(); @@ -75,7 +77,7 @@ public class UrlValidatorTest extends Assert * test */ @Test - public void testIsValidScheme() + void testIsValidScheme() { if (printStatus) { @@ -87,7 +89,7 @@ public class UrlValidatorTest extends Assert for (ResultPair testPair : testScheme) { boolean result = urlVal.isValidScheme(testPair.item); - assertEquals(testPair.item, testPair.valid, result); + assertEquals(testPair.valid, result, testPair.item); if (printStatus) { if (result == testPair.valid) @@ -158,7 +160,7 @@ public class UrlValidatorTest extends Assert { System.out.println(output + " - " + expected + " - " + url); } - assertEquals(url, expected, result); + assertEquals(expected, result, url); if (printStatus) { if (printIndex) @@ -195,7 +197,7 @@ public class UrlValidatorTest extends Assert * test */ @Test - public void testValidator202() + void testValidator202() { String[] schemes = { "http", "https" }; UrlValidator urlValidator = new UrlValidator(schemes, UrlValidator.NO_FRAGMENTS); @@ -206,7 +208,7 @@ public class UrlValidatorTest extends Assert * test */ @Test - public void testValidator204() + void testValidator204() { String[] schemes = { "http", "https" }; UrlValidator UrlValidator = new UrlValidator(schemes); @@ -217,7 +219,7 @@ public class UrlValidatorTest extends Assert * test */ @Test - public void testValidator206() + void testValidator206() { UrlValidator urlVal = new UrlValidator(null, UrlValidator.ALLOW_ALL_SCHEMES); assertTrue(urlVal.isValid("http://user@host:80/path")); @@ -230,7 +232,7 @@ public class UrlValidatorTest extends Assert * @param testParts * @return boolean */ - static boolean incrementTestPartsIndex(int[] testPartsIndex, Object[] testParts) + private static boolean incrementTestPartsIndex(int[] testPartsIndex, Object[] testParts) { boolean carry = true; // add 1 to lowest order part. boolean maxIndex = true; @@ -289,12 +291,12 @@ public class UrlValidatorTest extends Assert * permutations. A complete URL is composed of a scheme+authority+port+path+query, all of which * must be individually valid for the entire URL to be considered valid. */ - ResultPair[] testUrlScheme = { new ResultPair("http://", true), new ResultPair("ftp://", true), + private ResultPair[] testUrlScheme = { new ResultPair("http://", true), new ResultPair("ftp://", true), new ResultPair("h3t://", true), new ResultPair("3ht://", false), new ResultPair("http:/", false), new ResultPair("http:", false), new ResultPair("http/", false), new ResultPair("://", false), new ResultPair("", true) }; - ResultPair[] testUrlAuthority = { new ResultPair("www.google.com", true), + private ResultPair[] testUrlAuthority = { new ResultPair("www.google.com", true), new ResultPair("go.com", true), new ResultPair("go.au", true), new ResultPair("0.0.0.0", true), new ResultPair("255.255.255.255", true), new ResultPair("256.256.256.256", false), new ResultPair("255.com", true), @@ -308,17 +310,17 @@ public class UrlValidatorTest extends Assert * , new ResultPair("", false) In combination with "http:/" + "/test1" the expected result is * true */}; - ResultPair[] testUrlPort = { new ResultPair(":80", true), new ResultPair(":65535", true), + private ResultPair[] testUrlPort = { new ResultPair(":80", true), new ResultPair(":65535", true), new ResultPair(":0", true), new ResultPair("", true), new ResultPair(":-1", false), new ResultPair(":65636", true), new ResultPair(":65a", false) }; - ResultPair[] testPath = { new ResultPair("/test1", true), new ResultPair("/t123", true), + private ResultPair[] testPath = { new ResultPair("/test1", true), new ResultPair("/t123", true), new ResultPair("/$23", true), new ResultPair("/..", false), new ResultPair("/../", false), new ResultPair("/test1/", true), new ResultPair("", true), new ResultPair("/test1/file", true), new ResultPair("/..//file", false), new ResultPair("/test1//file", false), new ResultPair("/this_one_is_tricky...but...still.....valid", true) }; // Test allow2slash, noFragment - ResultPair[] testUrlPathOptions = { new ResultPair("/test1", true), + private ResultPair[] testUrlPathOptions = { new ResultPair("/test1", true), new ResultPair("/t123", true), new ResultPair("/$23", true), new ResultPair("/..", false), new ResultPair("/../", false), new ResultPair("/test1/", true), new ResultPair("/#", false), new ResultPair("", true), @@ -327,25 +329,25 @@ public class UrlValidatorTest extends Assert new ResultPair("/..//file", false), new ResultPair("/test1//file", true), new ResultPair("/#/file", false) }; - ResultPair[] testUrlQuery = { new ResultPair("?action=view", true), + private ResultPair[] testUrlQuery = { new ResultPair("?action=view", true), new ResultPair("?action=edit&mode=up", true), new ResultPair("", true) }; - Object[] testUrlParts = { testUrlScheme, testUrlAuthority, testUrlPort, testPath, testUrlQuery }; - Object[] testUrlPartsOptions = { testUrlScheme, testUrlAuthority, testUrlPort, + private Object[] testUrlParts = { testUrlScheme, testUrlAuthority, testUrlPort, testPath, testUrlQuery }; + private Object[] testUrlPartsOptions = { testUrlScheme, testUrlAuthority, testUrlPort, testUrlPathOptions, testUrlQuery }; - int[] testPartsIndex = { 0, 0, 0, 0, 0 }; + private int[] testPartsIndex = { 0, 0, 0, 0, 0 }; // ---------------- Test data for individual url parts ---------------- - ResultPair[] testScheme = { new ResultPair("http", true), new ResultPair("ftp", false), + private ResultPair[] testScheme = { new ResultPair("http", true), new ResultPair("ftp", false), new ResultPair("httpd", false), new ResultPair("telnet", false) }; class ResultPair { - public String item; - public boolean valid; + String item; + boolean valid; - public ResultPair(String item, boolean valid) + ResultPair(String item, boolean valid) { this.item = item; this.valid = valid; // Weather the individual part of url is valid. http://git-wip-us.apache.org/repos/asf/wicket/blob/645f239c/wicket-core/src/test/java/org/apache/wicket/versioning/PageVersioningTest.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/versioning/PageVersioningTest.java b/wicket-core/src/test/java/org/apache/wicket/versioning/PageVersioningTest.java index 9ac60fc..6f10ada 100644 --- a/wicket-core/src/test/java/org/apache/wicket/versioning/PageVersioningTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/versioning/PageVersioningTest.java @@ -16,8 +16,8 @@ */ package org.apache.wicket.versioning; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import org.apache.wicket.IPageManagerProvider; import org.apache.wicket.Page; @@ -30,22 +30,22 @@ import org.apache.wicket.pageStore.IDataStore; import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.serialize.java.JavaSerializer; import org.apache.wicket.util.tester.WicketTester; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * A test for page versioning */ -public class PageVersioningTest +class PageVersioningTest { - WicketTester wicketTester; + private WicketTester wicketTester; /** * setup() */ - @Before - public void setup() + @BeforeEach + void setup() { final PageVersioningApplication application = new PageVersioningApplication(); @@ -81,8 +81,8 @@ public class PageVersioningTest /** */ - @After - public void after() + @AfterEach + void after() { wicketTester.destroy(); } @@ -91,7 +91,7 @@ public class PageVersioningTest * versionPage() */ @Test - public void versionPage() + void versionPage() { Page versioningPage = wicketTester.startPage(VersioningTestPage.class);
