Created
January 19, 2015 13:25
-
-
Save freekman/cc83b53402192190e9b8 to your computer and use it in GitHub Desktop.
Interface Separation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package task4; | |
import java.util.List; | |
/** | |
* @author Ivan Genchev ([email protected]) | |
*/ | |
public class MyClass { | |
class Customer { | |
} | |
// | |
// interface CustomerRepository { | |
// void register(Customer customer); | |
// | |
// List<Customer> findAll(); | |
// } | |
// | |
interface CustomerFinder { | |
List<Customer> findAll(); | |
} | |
interface CustomerRegistry { | |
void register(Customer customer); | |
} | |
class PersistentCustomerRepository implements CustomerFinder, CustomerRegistry { | |
@Override | |
public List<Customer> findAll() { | |
return null; | |
} | |
@Override | |
public void register(Customer customer) { | |
} | |
} | |
class ClassUnderTest { | |
private final CustomerFinder finder; | |
ClassUnderTest(CustomerFinder finder) { | |
this.finder = finder; | |
} | |
public void method1() { | |
finder.findAll(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment