Last active
March 20, 2025 23:47
-
-
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)
This file contains hidden or 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
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