3 Replies Latest reply on Apr 14, 2008 6:00 PM by 807591

    Inline Subclassing: Why won't this override work?

      I'm writing some unit tests (I'm new to JUnit and JMock), and have been having trouble figuring out how to mock an object that doesn't implement an interface. As a work around, I wrote the following:
      ExecuteSupportSvc ess = new ExecuteSupportSvc() {
                private MessageHelper createMessageHelper() {
                     return new MessageHelper() {
                          public Integer countMessages(String a, String b, String c) {
                               return 1;
      I get the error:
      The method createMessageHelper() of type new ExecuteSupportSvc(){} must override a 
       superclass method
      There definitely is a method createMessageHelper in my superclass... am I missing something??

      Edited by: Pojo on Apr 14, 2008 10:53 AM