Reviewers: jgw, Description: http://code.google.com/p/google-web-toolkit/issues/detail?id=3464
Fixes problem where if you try to create a mock instance of DateBox (e.g. via easymock classextension), you fail with an NPE in LocaleInfo.ensureDateTimeConstants. Extends ClassInitTest to cover date classes Please review this at http://gwt-code-reviews.appspot.com/12803 Affected files: user/src/com/google/gwt/user/datepicker/client/DateBox.java user/test/com/google/gwt/user/ClassInitTest.java Index: user/test/com/google/gwt/user/ClassInitTest.java =================================================================== --- user/test/com/google/gwt/user/ClassInitTest.java (revision 4989) +++ user/test/com/google/gwt/user/ClassInitTest.java (working copy) @@ -22,10 +22,10 @@ import java.io.File; /** - * Tests that every class in com.google.gwt.user.client.ui can be init'd by the - * real Java runtime. By ensuring this, we ensure that these classes all may be - * referenced mocked out by pure Java unit tests, e.g. with EasyMock Class - * Extension + * Tests that every class in com.google.gwt.user.client.ui and + * com.google.gwt.user.datepicker.client can be init'd by the real Java + * runtime. By ensuring this, we ensure that these classes all may be referenced + * mocked out by pure Java unit tests, e.g. with EasyMock Class Extension */ public class ClassInitTest extends TestCase { private static final String DOT_CLASS = ".class"; @@ -41,8 +41,15 @@ GWTMockUtilities.restore(); } - public void testOne() throws ClassNotFoundException { - String packageName = "com.google.gwt.user.client.ui"; + public void testUi() throws ClassNotFoundException { + doPackage("com.google.gwt.user.client.ui"); + } + + public void testDatePicker() throws ClassNotFoundException { + doPackage("com.google.gwt.user.datepicker.client"); + } + + private void doPackage(String packageName) throws ClassNotFoundException { String path = packageNameToPath(packageName); File directory = pathToResourceDirectory(path); Index: user/src/com/google/gwt/user/datepicker/client/DateBox.java =================================================================== --- user/src/com/google/gwt/user/datepicker/client/DateBox.java (revision 4989) +++ user/src/com/google/gwt/user/datepicker/client/DateBox.java (working copy) @@ -16,6 +16,7 @@ package com.google.gwt.user.datepicker.client; +import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.BlurHandler; import com.google.gwt.event.dom.client.ClickEvent; @@ -239,7 +240,8 @@ * Default style name. */ public static final String DEFAULT_STYLENAME = "gwt-DateBox"; - private static final DefaultFormat DEFAULT_FORMAT = new DefaultFormat(); + private static final DefaultFormat DEFAULT_FORMAT = + GWT.create(DefaultFormat.class); private final PopupPanel popup; private final TextBox box = new TextBox(); private final DatePicker picker; --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
