Revision: 6067 Author: [email protected] Date: Tue Sep 1 15:46:20 2009 Log: Revert r6063, "Internal contribution that extends FakeMessagesMaker to work with Constants as well." It doesn't compile. And yet I would swear that I tested it.
http://code.google.com/p/google-web-toolkit/source/detail?r=6067 Modified: /trunk/user/src/com/google/gwt/junit/FakeMessagesMaker.java /trunk/user/test/com/google/gwt/junit/FakeMessagesMakerTest.java ======================================= --- /trunk/user/src/com/google/gwt/junit/FakeMessagesMaker.java Tue Sep 1 15:18:26 2009 +++ /trunk/user/src/com/google/gwt/junit/FakeMessagesMaker.java Tue Sep 1 15:46:20 2009 @@ -1,12 +1,12 @@ /* * Copyright 2009 Google Inc. - * + * * Licensed 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 @@ -15,7 +15,6 @@ */ package com.google.gwt.junit; -import com.google.gwt.i18n.client.Constants; import com.google.gwt.i18n.client.Messages; import java.lang.reflect.InvocationHandler; @@ -24,10 +23,10 @@ import java.util.Arrays; /** - * Helper to make a fake implementation of any {...@link Messages} or - * {...@link Constants} interface via reflection, for use in JUnit tests. (This - * will not work in GWTTestCase.) All calls to the returned object return the - * method name followed by the passed parameters as a list surrounded by []. + * Helper to make a fake implementation of any {...@link Messages} interface via + * reflection, for use in JUnit tests. (This will not work in GWTTestCase.) All + * calls to the returned object return the method name followed by the passed + * parameters as a list surrounded by []. * <p> * Note that the default message text is very consciously not made available * through the fake, to help tests ensure that specific translations of @@ -53,12 +52,6 @@ FakeMessagesMaker.class.getClassLoader(), new Class[] {messagesClass}, new FakeMessagesMaker())); } - - public static <T extends Constants> T create(Class<T> constantsClass) { - return constantsClass.cast(Proxy.newProxyInstance( - FakeMessagesMaker.class.getClassLoader(), new Class[] {constantsClass}, - new FakeMessagesMaker())); - } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { ======================================= --- /trunk/user/test/com/google/gwt/junit/FakeMessagesMakerTest.java Tue Sep 1 15:18:26 2009 +++ /trunk/user/test/com/google/gwt/junit/FakeMessagesMakerTest.java Tue Sep 1 15:46:20 2009 @@ -1,12 +1,12 @@ /* * Copyright 2009 Google Inc. - * + * * Licensed 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 @@ -15,7 +15,6 @@ */ package com.google.gwt.junit; -import com.google.gwt.i18n.client.Constants; import com.google.gwt.i18n.client.Messages; import junit.framework.TestCase; @@ -28,41 +27,21 @@ @DefaultMessage("Isn''t this the fakiest?") @Description("A sample message to be tested.") String myMessage(); - + @DefaultMessage("Isn''t this the fakiest? Pick one: {1} or {2}?") @Description("A sample message with parameters.") - String myArgumentedMessage(@Example("yes") String yes, + String myArgumentedMessage(@Example("yes") String yes, @Example("no") String no); } - - interface MyConstants extends Constants { - @DefaultStringValue("This is a very simple message") - String myFixedMessage(); - - @DefaultStringValue("This message is so complicated, it requires a description") - @Description("42") - String messageWithDescription(); - } - - public void testSimpleWithMessages() { + + public void testSimple() { MyMessages messages = FakeMessagesMaker.create(MyMessages.class); assertEquals("myMessage", messages.myMessage()); } - - public void testArgsWithMessages() { + + public void testArgs() { MyMessages messages = FakeMessagesMaker.create(MyMessages.class); - assertEquals("myArgumentedMessage[oui, non]", + assertEquals("myArgumentedMessage[oui, non]", messages.myArgumentedMessage("oui", "non")); } - - public void testSimpleWithConstants() { - MyConstants constants = FakeMessagesMaker.create(MyConstants.class); - assertEquals("myFixedMessage", constants.myFixedMessage()); - } - - public void testConstantWithDescription() { - MyConstants constants = FakeMessagesMaker.create(MyConstants.class); - assertEquals("messageWithDescription", constants.messageWithDescription()); - } - -} +} --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
