Extending/replacing a class without a public constructor

From: Hugh Beyer (beyerxyzzy_at_acm.org)
Date: 06/10/04


Date: Thu, 10 Jun 2004 16:48:56 GMT

I'm having a really frustrating problem and I hope you guys can give me
some help.

I'm trying to write a test suite for a graphics-heavy app that uses
MIDP/J2ME. These apps use the Graphics class to do their screen updates.

What I want to do is subclass the Graphics class with my own class that
captures all calls and writes to a log that my tests can later examine.
Unfortunately, all the constructors of the Graphics class are private. The
system passes in a Graphics class when it's time to update the screen, and
you can also create a graphics class through a static factory method
(Image.getGraphics()). But either way, I can't get in and capture the
method calls to the resulting Graphics object.

Is there any way at all to do this, or am I SOL? Can anyone think of
another way to accomplish what I want?
            
            Hugh



Relevant Pages

  • Re: Extending/replacing a class without a public constructor
    ... > I'm trying to write a test suite for a graphics-heavy app that uses ... These apps use the Graphics class to do their screen updates. ...
    (comp.lang.java.programmer)
  • Extending/replacing a class without a public constructor
    ... I'm trying to write a test suite for a graphics-heavy app that uses ... These apps use the Graphics class to do their screen updates. ... static factory method ). ...
    (comp.lang.java.developer)
  • Re: Problem with Graphics Class...
    ... Please post the code that causes the exception. ... Graphics Transform stack and Flood-Filling ... "Sujith Manuel" wrote in message ... > Iam also using Disposemethod of Graphics Class. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Graphics.ScaleTransform vs. Graphics.Transform.Scale
    ... Actually there is a difference - asking for the transform of the graphics ... object will create a copy of the transform used by the graphics object. ... on the graphics class itself. ...
    (microsoft.public.dotnet.framework.drawing)