in reply to Re (tilly) 1: Nested Classes
in thread Nested Classes
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 |