in reply to Re (tilly) 1: Nested Classes
in thread Nested Classes
Thanks. I think that the might achieve what I was after. Since there was some confusion
about what I really want to do, and why, I'll try to give you an example, but
I'm going to have to show it in pseudo-java.
now, I want to write code that tests Foo.doSomething. I want that test to be independent of any problems that Bar might have. So, I write this...public class Foo { public void doSomething(Bar bar) { ... } }
public class FooTest { testDoSomething() { class MockBar extends Bar { // code to simulate a "Bar" } ... bar = new MockBar(); foo = new Foo(); foo.doSomething(bar); // check that the right things happened to bar } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re (tilly) 3: Nested Classes
by tilly (Archbishop) on Mar 06, 2001 at 22:22 UTC | |
by dcorbin (Sexton) on Mar 07, 2001 at 02:06 UTC |
In Section
Seekers of Perl Wisdom