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. git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6067 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/junit/FakeMessagesMaker.java b/user/src/com/google/gwt/junit/FakeMessagesMaker.java index 1f94ab7..dc37afc 100644 --- a/user/src/com/google/gwt/junit/FakeMessagesMaker.java +++ b/user/src/com/google/gwt/junit/FakeMessagesMaker.java
@@ -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 @@ -54,12 +53,6 @@ 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 { String name = method.getName();
diff --git a/user/test/com/google/gwt/junit/FakeMessagesMakerTest.java b/user/test/com/google/gwt/junit/FakeMessagesMakerTest.java index 72c1524..ddf541e 100644 --- a/user/test/com/google/gwt/junit/FakeMessagesMakerTest.java +++ b/user/test/com/google/gwt/junit/FakeMessagesMakerTest.java
@@ -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()); - } - }