If you don't want to use DI or Factories. You can refactor your class in a little tricky way:
public class Foo {
private Bar bar;
public void foo(Bar bar){
this.bar = (bar != null) ? bar : new Bar();
bar.someMethod();
this.bar = null; // for simulating local scope
}
}
And your test class:
@RunWith(MockitoJUnitRunner.class)
public class FooTest {
@Mock Bar barMock;
Foo foo;
@Test
public void testFoo() {
foo = new Foo();
foo.foo(barMock);
verify(barMock, times(1)).someMethod();
}
}
Then the class that is calling your foo method will do it like this:
public class thirdClass {
public void someOtherMethod() {
Foo myFoo = new Foo();
myFoo.foo(null);
}
}
As you can see when calling the method this way, you don't need to import the Bar class in any other class that is calling your foo method which is maybe something you want.
Of course the downside is that you are allowing the caller to set the Bar Object.
Hope it helps.