diff --git a/.gitignore b/.gitignore index 3eba9d2b..90a5690a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,7 @@ org.eclipse.jdt.apt.core.prefs org.eclipse.m2e.core.prefs org.eclipse.pde.core.prefs +.idea + wiquery-*.i* rebel.xml diff --git a/README.md b/README.md index af93444a..614065ce 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# WiQuery for Apache Wicket 8.x +# WiQuery for Apache Wicket WiQuery is a project to simply Wicket integration with jQuery and jQuery UI. -This branch follows the development of Apache Wicket 8.x (the master branch of Apache Wicket) +This branch follows the development of Apache Wicket WiQuery consists of 3 subprojects: - core - the core library diff --git a/pom.xml b/pom.xml index 3518784a..49783bbb 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ org.wicketstuff.wiquery wiquery-parent pom - 9.0.0-SNAPSHOT + 9.1.0-SNAPSHOT WiQuery Parent @@ -61,11 +61,12 @@ 11 9.16.0 - 2.12.7.1 + 2.16.1 2.0.12 5.10.2 - 4.0.1 - 9.4.44.v20210927 + 4.0.4 + 9.4.54.v20240208 + 1.7.14 @@ -105,12 +106,6 @@ - - javax.servlet - javax.servlet-api - ${servlet-api.version} - provided - org.slf4j slf4j-api @@ -121,8 +116,19 @@ jackson-databind ${jackson.version} + + org.mozilla + rhino + ${rhino.version} + + + jakarta.servlet + jakarta.servlet-api + ${servlet-api.version} + test + org.junit.jupiter junit-jupiter-engine @@ -146,8 +152,9 @@ org.slf4j - slf4j-log4j12 + slf4j-reload4j ${slf4j.version} + test diff --git a/wiquery-core/pom.xml b/wiquery-core/pom.xml index 30463dc6..0b084729 100644 --- a/wiquery-core/pom.xml +++ b/wiquery-core/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff.wiquery wiquery-parent - 9.0.0-SNAPSHOT + 9.1.0-SNAPSHOT ../pom.xml wiquery-core @@ -25,23 +25,26 @@ org.junit.jupiter junit-jupiter-engine + test org.junit.jupiter junit-jupiter-params + test org.junit.vintage junit-vintage-engine + test org.slf4j - slf4j-log4j12 + slf4j-reload4j test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/wiquery-demo/pom.xml b/wiquery-demo/pom.xml index c27ae3af..c7986c80 100644 --- a/wiquery-demo/pom.xml +++ b/wiquery-demo/pom.xml @@ -4,7 +4,8 @@ wiquery-parent org.wicketstuff.wiquery - 9.0.0-SNAPSHOT + 9.1.0-SNAPSHOT + ../pom.xml wiquery-demo @@ -38,7 +39,7 @@ org.slf4j - slf4j-log4j12 + slf4j-reload4j test @@ -48,8 +49,8 @@ test - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api test diff --git a/wiquery-demo/src/main/java/org/wicketstuff/wiquery/datepicker/DatePickerPanel.java b/wiquery-demo/src/main/java/org/wicketstuff/wiquery/datepicker/DatePickerPanel.java index f521cb74..33e83c75 100644 --- a/wiquery-demo/src/main/java/org/wicketstuff/wiquery/datepicker/DatePickerPanel.java +++ b/wiquery-demo/src/main/java/org/wicketstuff/wiquery/datepicker/DatePickerPanel.java @@ -68,7 +68,7 @@ protected void onSubmit(AjaxRequestTarget target) withDropDownDatePicker.setChangeMonth(true); withDropDownDatePicker.setChangeYear(true); withDropDownDatePicker - .setYearRange(new DatePickerYearRange(new Short("-20"), new Short("20"), true)); + .setYearRange(new DatePickerYearRange(Short.parseShort("-20"), Short.parseShort("20"), true)); // Label withDropDownDatePicker.setLabel(Model.of("Year/month dropdown")); diff --git a/wiquery-jquery-ui/pom.xml b/wiquery-jquery-ui/pom.xml index 80191d9a..978e2bd6 100644 --- a/wiquery-jquery-ui/pom.xml +++ b/wiquery-jquery-ui/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff.wiquery wiquery-parent - 9.0.0-SNAPSHOT + 9.1.0-SNAPSHOT ../pom.xml wiquery-jquery-ui @@ -25,6 +25,11 @@ test + + org.mozilla + rhino + + org.junit.jupiter @@ -40,21 +45,11 @@ org.slf4j - slf4j-log4j12 - test + slf4j-reload4j - javax.servlet - javax.servlet-api - test - - - - - ro.isdc.wro4j - rhino - 1.7R5-20130223-1 - test + jakarta.servlet + jakarta.servlet-api diff --git a/wiquery-jquery-ui/src/main/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerOptions.java b/wiquery-jquery-ui/src/main/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerOptions.java index ed7497d7..c04df683 100644 --- a/wiquery-jquery-ui/src/main/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerOptions.java +++ b/wiquery-jquery-ui/src/main/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerOptions.java @@ -301,7 +301,7 @@ public DatePickerYearRange getYearRange() return (DatePickerYearRange)yearRange; } - return new DatePickerYearRange(new Short("-10"), new Short("10"), false); + return new DatePickerYearRange(Short.parseShort("-10"), Short.parseShort("10"), false); } /** @@ -698,7 +698,7 @@ public DatePickerNumberOfMonths getNumberOfMonths() return (DatePickerNumberOfMonths)numberOfMonths; } - return new DatePickerNumberOfMonths(new Short("1")); + return new DatePickerNumberOfMonths(Short.parseShort("1")); } /** diff --git a/wiquery-jquery-ui/src/main/resources/org/wicketstuff/wiquery/ui/datepicker/i18n/datepicker-he.js b/wiquery-jquery-ui/src/main/resources/org/wicketstuff/wiquery/ui/datepicker/i18n/datepicker-he.js new file mode 100644 index 00000000..fb6238fd --- /dev/null +++ b/wiquery-jquery-ui/src/main/resources/org/wicketstuff/wiquery/ui/datepicker/i18n/datepicker-he.js @@ -0,0 +1,37 @@ +/* Hebrew initialisation for the UI Datepicker extension. */ +/* Written by Amir Hardon (ahardon at gmail dot com). */ +( function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "../widgets/datepicker" ], factory ); + } else { + + // Browser globals + factory( jQuery.datepicker ); + } +}( function( datepicker ) { + +datepicker.regional.he = { + closeText: "סגור", + prevText: "<הקודם", + nextText: "הבא>", + currentText: "היום", + monthNames: [ "ינואר","פברואר","מרץ","אפריל","מאי","יוני", + "יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר" ], + monthNamesShort: [ "ינו","פבר","מרץ","אפר","מאי","יוני", + "יולי","אוג","ספט","אוק","נוב","דצמ" ], + dayNames: [ "ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת" ], + dayNamesShort: [ "א'","ב'","ג'","ד'","ה'","ו'","שבת" ], + dayNamesMin: [ "א'","ב'","ג'","ד'","ה'","ו'","שבת" ], + weekHeader: "Wk", + dateFormat: "dd/mm/yy", + firstDay: 0, + isRTL: true, + showMonthAfterYear: false, + yearSuffix: "" }; +datepicker.setDefaults( datepicker.regional.he ); + +return datepicker.regional.he; + +} ) ); diff --git a/wiquery-jquery-ui/src/main/resources/org/wicketstuff/wiquery/ui/datepicker/i18n/datepicker-id.js b/wiquery-jquery-ui/src/main/resources/org/wicketstuff/wiquery/ui/datepicker/i18n/datepicker-id.js new file mode 100644 index 00000000..5aef348a --- /dev/null +++ b/wiquery-jquery-ui/src/main/resources/org/wicketstuff/wiquery/ui/datepicker/i18n/datepicker-id.js @@ -0,0 +1,37 @@ +/* Indonesian initialisation for the jQuery UI date picker plugin. */ +/* Written by Deden Fathurahman (dedenf@gmail.com). */ +( function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "../widgets/datepicker" ], factory ); + } else { + + // Browser globals + factory( jQuery.datepicker ); + } +}( function( datepicker ) { + +datepicker.regional.id = { + closeText: "Tutup", + prevText: "<mundur", + nextText: "maju>", + currentText: "hari ini", + monthNames: [ "Januari","Februari","Maret","April","Mei","Juni", + "Juli","Agustus","September","Oktober","Nopember","Desember" ], + monthNamesShort: [ "Jan","Feb","Mar","Apr","Mei","Jun", + "Jul","Agus","Sep","Okt","Nop","Des" ], + dayNames: [ "Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu" ], + dayNamesShort: [ "Min","Sen","Sel","Rab","kam","Jum","Sab" ], + dayNamesMin: [ "Mg","Sn","Sl","Rb","Km","jm","Sb" ], + weekHeader: "Mg", + dateFormat: "dd/mm/yy", + firstDay: 0, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: "" }; +datepicker.setDefaults( datepicker.regional.id ); + +return datepicker.regional.id; + +} ) ); diff --git a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DateOptionTestCase.java b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DateOptionTestCase.java index 93f56740..2bd83b65 100644 --- a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DateOptionTestCase.java +++ b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DateOptionTestCase.java @@ -1,8 +1,5 @@ package org.wicketstuff.wiquery.ui.datepicker; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.util.GregorianCalendar; import org.junit.Test; @@ -10,6 +7,8 @@ import org.slf4j.LoggerFactory; import org.wicketstuff.wiquery.tester.WiQueryTestCase; +import static org.junit.Assert.*; + public class DateOptionTestCase extends WiQueryTestCase { protected static final Logger log = LoggerFactory.getLogger(DateOptionTestCase.class); @@ -17,7 +16,7 @@ public class DateOptionTestCase extends WiQueryTestCase @Test public void testGetJavaScriptOption() { - DateOption dateOption = new DateOption(new Short("5")); + DateOption dateOption = new DateOption(Short.parseShort("5")); // Short param String expectedJavascript = "5"; @@ -60,7 +59,7 @@ public void testGetJavaScriptOption() try { generatedJavascript = dateOption.getJavascriptOption().toString(); - assertTrue(false); + fail(); } catch (Exception e) { diff --git a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerDurationTestCase.java b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerDurationTestCase.java index 58a605fa..52bdf6f0 100644 --- a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerDurationTestCase.java +++ b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerDurationTestCase.java @@ -15,7 +15,7 @@ public class DatePickerDurationTestCase extends WiQueryTestCase @Test public void testGetJavaScriptOption() { - DatePickerShortYearCutOff shortYearCutOff = new DatePickerShortYearCutOff(new Short("5")); + DatePickerShortYearCutOff shortYearCutOff = new DatePickerShortYearCutOff(Short.parseShort("5")); // Short param String expectedJavascript = "5"; diff --git a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerLanguageResourceReferenceTestCase.java b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerLanguageResourceReferenceTestCase.java index f5c3286f..4b22b6c5 100644 --- a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerLanguageResourceReferenceTestCase.java +++ b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerLanguageResourceReferenceTestCase.java @@ -1,46 +1,55 @@ package org.wicketstuff.wiquery.ui.datepicker; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - import java.util.Locale; import org.apache.wicket.Application; import org.apache.wicket.core.util.resource.locator.IResourceStreamLocator; import org.apache.wicket.util.lang.Packages; -import org.junit.Test; + +import org.junit.jupiter.api.condition.EnabledForJreRange; +import org.junit.jupiter.api.condition.EnabledOnJre; +import org.junit.jupiter.api.condition.JRE; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.wicketstuff.wiquery.tester.WiQueryTestCase; -import org.wicketstuff.wiquery.ui.datepicker.DatePickerLanguageResourceReference; +import org.wicketstuff.wiquery.tester.WiQueryTester; import org.wicketstuff.wiquery.ui.datepicker.DatePickerLanguageResourceReference.DatePickerLanguages; +import static org.junit.jupiter.api.Assertions.*; + /** * Unit test on the {@link DatePickerLanguageResourceReference} * * @author Julien Roche * @author Hielke Hoeve */ -public class DatePickerLanguageResourceReferenceTestCase extends WiQueryTestCase +public class DatePickerLanguageResourceReferenceTestCase { + WiQueryTester tester = new WiQueryTester(); + protected static final Logger log = LoggerFactory .getLogger(DatePickerLanguageResourceReferenceTestCase.class); @Test - public void testGetDatePickerLanguages() + public void testGetDatePickerLanguagesUnavailable() { Locale nonavailableLocale = new Locale("wiquery"); - Locale availableLocale = DatePickerLanguages.ARMENIAN.getLocale(); assertNull(DatePickerLanguages.getDatePickerLanguages(nonavailableLocale)); assertNull(DatePickerLanguageResourceReference.get(nonavailableLocale)); + } + + @Test + public void testGetDatePickerLanguagesAvailable() { + Locale availableLocale = DatePickerLanguages.ARMENIAN.getLocale(); assertNotNull(DatePickerLanguages.getDatePickerLanguages(availableLocale)); assertNotNull(DatePickerLanguageResourceReference.get(availableLocale)); + } + @Test + public void testGetDatePickerLanguages() { for (DatePickerLanguages language : DatePickerLanguages.values()) { // assert if the language getter is implemented correctly to return @@ -59,9 +68,9 @@ public void testGetDatePickerLanguages() String absolutePath = Packages.absolutePath(DatePickerLanguageResourceReference.class, DatePickerLanguages.getJsFileName(language)); - assertNotNull("Resource " + DatePickerLanguages.getJsFileName(language) - + " for locale " + language.getLocale() + " does not exist!", - locator.locate(DatePickerLanguageResourceReference.class, absolutePath)); + assertNotNull(locator.locate(DatePickerLanguageResourceReference.class, absolutePath), + "Resource " + DatePickerLanguages.getJsFileName(language) + + " for locale " + language.getLocale() + " does not exist!"); } } @@ -70,28 +79,30 @@ public void testGetJsFileName() { assertNull(DatePickerLanguages.getJsFileName(null)); - assertEquals(DatePickerLanguages.getJsFileName(DatePickerLanguages.FRENCH).toString(), + assertEquals(DatePickerLanguages.getJsFileName(DatePickerLanguages.FRENCH), "i18n/datepicker-fr.js"); - assertEquals(DatePickerLanguages.getJsFileName(DatePickerLanguages.SERBIA).toString(), + assertEquals(DatePickerLanguages.getJsFileName(DatePickerLanguages.SERBIA), "i18n/datepicker-sr-SR.js"); } @Test - public void testRenamedLocales() { - assertEquals(DatePickerLanguages.INDONESIAN, - DatePickerLanguages.getDatePickerLanguages(new Locale("id"))); + @EnabledForJreRange(min = JRE.JAVA_17) + public void testRenamedLocales_JDK17OrLater() + { assertEquals(DatePickerLanguages.INDONESIAN, DatePickerLanguages.getDatePickerLanguages(new Locale("in"))); - assertEquals(DatePickerLanguages.getJsFileName(DatePickerLanguages.INDONESIAN).toString(), - "i18n/datepicker-in.js"); + assertEquals(DatePickerLanguages.INDONESIAN, + DatePickerLanguages.getDatePickerLanguages(new Locale("id"))); + assertEquals(DatePickerLanguages.getJsFileName(DatePickerLanguages.INDONESIAN), + "i18n/datepicker-id.js"); assertEquals(DatePickerLanguages.HEBREW, DatePickerLanguages.getDatePickerLanguages(new Locale("he"))); assertEquals(DatePickerLanguages.HEBREW, DatePickerLanguages.getDatePickerLanguages(new Locale("iw"))); - assertEquals(DatePickerLanguages.getJsFileName(DatePickerLanguages.HEBREW).toString(), - "i18n/datepicker-iw.js"); + assertEquals(DatePickerLanguages.getJsFileName(DatePickerLanguages.HEBREW), + "i18n/datepicker-he.js"); // Yiddish does not (yet) have i18n assertNull(DatePickerLanguages.getDatePickerLanguages(new Locale("ji"))); @@ -101,9 +112,21 @@ public void testRenamedLocales() { assertNotEquals(new Locale("kk"), new Locale("kz")); } - @Override - protected Logger getLog() - { - return log; + @Test + @EnabledForJreRange(max =JRE.JAVA_16) + public void testRenamedLocales_preJava17() { + assertEquals(DatePickerLanguages.INDONESIAN, + DatePickerLanguages.getDatePickerLanguages(new Locale("in"))); + assertEquals(DatePickerLanguages.INDONESIAN, + DatePickerLanguages.getDatePickerLanguages(new Locale("id"))); + assertEquals(DatePickerLanguages.getJsFileName(DatePickerLanguages.INDONESIAN), + "i18n/datepicker-in.js"); + + assertEquals(DatePickerLanguages.HEBREW, + DatePickerLanguages.getDatePickerLanguages(new Locale("he"))); + assertEquals(DatePickerLanguages.HEBREW, + DatePickerLanguages.getDatePickerLanguages(new Locale("iw"))); + assertEquals(DatePickerLanguages.getJsFileName(DatePickerLanguages.HEBREW), + "i18n/datepicker-iw.js"); } } \ No newline at end of file diff --git a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerNumberOfMonthsTestCase.java b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerNumberOfMonthsTestCase.java index cd7dd129..2520771b 100644 --- a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerNumberOfMonthsTestCase.java +++ b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerNumberOfMonthsTestCase.java @@ -1,13 +1,12 @@ package org.wicketstuff.wiquery.ui.datepicker; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.wicketstuff.wiquery.tester.WiQueryTestCase; +import static org.junit.Assert.*; + public class DatePickerNumberOfMonthsTestCase extends WiQueryTestCase { protected static final Logger log = LoggerFactory @@ -16,7 +15,7 @@ public class DatePickerNumberOfMonthsTestCase extends WiQueryTestCase @Test public void testGetJavaScriptOption() { - DatePickerDuration duration = new DatePickerDuration(new Short("5")); + DatePickerDuration duration = new DatePickerDuration(Short.parseShort("5")); // Short param String expectedJavascript = "5"; @@ -40,7 +39,7 @@ public void testGetJavaScriptOption() try { generatedJavascript = duration.getJavascriptOption().toString(); - assertTrue(false); + fail(); } catch (Exception e) { diff --git a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerShortYearCutOffTestCase.java b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerShortYearCutOffTestCase.java index eda70b30..9e818102 100644 --- a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerShortYearCutOffTestCase.java +++ b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerShortYearCutOffTestCase.java @@ -18,7 +18,7 @@ public class DatePickerShortYearCutOffTestCase extends WiQueryTestCase @Test public void testGetJavaScriptOption() { - DatePickerNumberOfMonths numberOfMonths = new DatePickerNumberOfMonths(new Short("5")); + DatePickerNumberOfMonths numberOfMonths = new DatePickerNumberOfMonths(Short.parseShort("5")); // Short param String expectedJavascript = "5"; diff --git a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerTestCase.java b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerTestCase.java index d8269531..d3127c80 100644 --- a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerTestCase.java +++ b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerTestCase.java @@ -264,7 +264,7 @@ public void testGetDuration() public void testGetFirstDay() { assertEquals(datePicker.getFirstDay(), 0); - datePicker.setFirstDay(new Short("1")); + datePicker.setFirstDay(Short.parseShort("1")); assertEquals(datePicker.getFirstDay(), 1); } @@ -344,7 +344,7 @@ public void testGetNumberOfMonths() { assertNotNull(datePicker.getNumberOfMonths()); assertEquals(datePicker.getNumberOfMonths().getJavascriptOption().toString(), "1"); - datePicker.setNumberOfMonths(new DatePickerNumberOfMonths(new Short("2"))); + datePicker.setNumberOfMonths(new DatePickerNumberOfMonths(Short.parseShort("2"))); assertEquals(datePicker.getNumberOfMonths().getJavascriptOption().toString(), "2"); } @@ -404,7 +404,7 @@ public void testGetShowAnim() public void testGetShowCurrentAtPos() { assertEquals(datePicker.getShowCurrentAtPos(), 0); - datePicker.setShowCurrentAtPos(new Short("1")); + datePicker.setShowCurrentAtPos(Short.parseShort("1")); assertEquals(datePicker.getShowCurrentAtPos(), 1); } @@ -435,7 +435,7 @@ public void testGetShowOptions() public void testGetStepMonths() { assertEquals(datePicker.getStepMonths(), 1); - datePicker.setStepMonths(new Short("5")); + datePicker.setStepMonths(Short.parseShort("5")); assertEquals(datePicker.getStepMonths(), 5); } @@ -458,10 +458,10 @@ public void testGetYearRange() { assertNotNull(datePicker.getYearRange()); assertEquals(datePicker.getYearRange().getJavascriptOption().toString(), "'c-10:c+10'"); - datePicker.setYearRange(new DatePickerYearRange(new Short("-10"), new Short("10"))); + datePicker.setYearRange(new DatePickerYearRange(Short.parseShort("-10"), Short.parseShort("10"))); assertNotNull(datePicker.getYearRange()); assertEquals(datePicker.getYearRange().getJavascriptOption().toString(), "'-10:10'"); - datePicker.setYearRange(new DatePickerYearRange(new Short("-20"), new Short("20"))); + datePicker.setYearRange(new DatePickerYearRange(Short.parseShort("-20"), Short.parseShort("20"))); assertEquals(datePicker.getYearRange().getJavascriptOption().toString(), "'-20:20'"); } @@ -492,8 +492,8 @@ public void testHide() @Test public void testHideShort() { - assertNotNull(datePicker.hide(new Short("5"))); - assertEquals(datePicker.hide(new Short("5")).render().toString(), + assertNotNull(datePicker.hide(Short.parseShort("5"))); + assertEquals(datePicker.hide(Short.parseShort("5")).render().toString(), "$('#anId').datepicker('hide', 5);"); } diff --git a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerYearRangeTestCase.java b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerYearRangeTestCase.java index 8d092394..26f5923e 100644 --- a/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerYearRangeTestCase.java +++ b/wiquery-jquery-ui/src/test/java/org/wicketstuff/wiquery/ui/datepicker/DatePickerYearRangeTestCase.java @@ -15,8 +15,8 @@ public class DatePickerYearRangeTestCase extends WiQueryTestCase @Test public void testGetJavaScriptOption() { - DatePickerYearRange yearRange = new DatePickerYearRange(new Short("2000"), - new Short("2010")); + DatePickerYearRange yearRange = new DatePickerYearRange(Short.parseShort("2000"), + Short.parseShort("2010")); // Absolute String expectedJavascript = "'2000:2010'"; @@ -27,7 +27,7 @@ public void testGetJavaScriptOption() assertEquals(generatedJavascript, expectedJavascript); // Relative today - yearRange.setRelativeRange(new Short("-10"), new Short("10"), true); + yearRange.setRelativeRange(Short.parseShort("-10"), Short.parseShort("10"), true); expectedJavascript = "'-10:+10'"; generatedJavascript = yearRange.getJavascriptOption().toString(); @@ -36,7 +36,7 @@ public void testGetJavaScriptOption() assertEquals(generatedJavascript, expectedJavascript); // Relative to the selected date - yearRange.setRelativeRange(new Short("-10"), new Short("10"), false); + yearRange.setRelativeRange(Short.parseShort("-10"), Short.parseShort("10"), false); expectedJavascript = "'c-10:c+10'"; generatedJavascript = yearRange.getJavascriptOption().toString(); @@ -45,7 +45,7 @@ public void testGetJavaScriptOption() assertEquals(generatedJavascript, expectedJavascript); // Mixed range - yearRange.setRange(new Short("2000"), new Short("-10"), DatePickerYearRangeControl.ABSOLUTE, + yearRange.setRange(Short.parseShort("2000"), Short.parseShort("-10"), DatePickerYearRangeControl.ABSOLUTE, DatePickerYearRangeControl.RELATIVE_TODAY); expectedJavascript = "'2000:-10'"; generatedJavascript = yearRange.getJavascriptOption().toString();