void () { myBuilder = new RichTextControlBuilder(); myMockery = new JUnit4Mockery() {{ setImposteriser(ClassImposteriser.INSTANCE); }}; myProcessor = myMockery.mock(RichTextControlBuilder.RichTextProcessor.class); myMockery.checking(new Expectations() {{ allowing(myProcessor).getKey(); will(returnValue(META_KEY)); }}); myBuilder.registerProcessor(myProcessor); }