public class


extends Object
implements InvocationHandler

Class Overview

Helper to make a fake implementation of any 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 [].

Note that the default message text is very consciously not made available through the fake, to help tests ensure that specific translations of localized text are not relied upon.

Sample use:

interface MyMessages extends Messages {
   @DefaultMessage("Isn''t this the fakiest?")
   @Description("A sample message to be tested.")
   String myMessage();

 public void testSimple() {
  MyMessages messages = FakeMessagesMaker.create(MyMessages.class);
  assertEquals("myMessage", messages.myMessage());


Public Constructors
Public Methods
static <T extends Messages> T create(Class<T> messagesClass)
Object invoke(Object proxy, Method method, Object[] args)
Inherited Methods
From class java.lang.Object
From interface java.lang.reflect.InvocationHandler

Public Constructors

public FakeMessagesMaker ()

Public Methods

public static T create (Class<T> messagesClass)

public Object invoke (Object proxy, Method method, Object[] args)