Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Last active March 20, 2025 23:47
Show Gist options
  • Save trikitrok/72947368d3590105bc9fa0af8cf2a162 to your computer and use it in GitHub Desktop.
Save trikitrok/72947368d3590105bc9fa0af8cf2a162 to your computer and use it in GitHub Desktop.
Adapt Parameter initial code: we don't own the interface AcmeInputReader (it's an Acme's interface)
class Library {
private readonly display: Display;
constructor(display: Display) {
this.display = display;
}
// we don't want to use a test double of an interface we don't own
printBooks(books: Book[], inputReader: AcmeInputReader): void {
const libraryName = inputReader.readLine();
this.display.show(libraryName);
for (const book of books) {
this.display.show(book.getName());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment