Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Renamed Keyboard to more generic term (InputDevice)

  • Loading branch information...
commit a6660c30be1bcf479d24f9dcfcefd115941c84f1 1 parent 6b14d38
@ClausPolanka authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 src/test/unit/java/test/unit/spikes/ReadingFromConsoleTest.java
View
13 src/test/unit/java/test/unit/spikes/ReadingFromConsoleTest.java
@@ -19,7 +19,7 @@
public InputProcessor inputProcessor;
@Mock
- public Keyboard keyboard;
+ public InputDevice keyboard;
@Test
public void testOneInputFromKeyBoard() throws Exception {
@@ -60,7 +60,7 @@ public void testThreeInputsFromKeyBoard() throws Exception {
void process(String input);
}
- interface Keyboard {
+ interface InputDevice {
String getInput();
}
@@ -71,9 +71,9 @@ public Application(InputProcessor inputProcessor) {
this.inputProcessor = inputProcessor;
}
- public void readInputFrom(Keyboard keyboard) {
+ public void readInputFrom(InputDevice inputDevice) {
while (true) {
- String input = keyboard.getInput();
+ String input = inputDevice.getInput();
if (input.equals("quit")) {
break;
}
@@ -81,7 +81,8 @@ public void readInputFrom(Keyboard keyboard) {
}
}
}
- static class ConsoleKeyboard implements Keyboard {
+
+ static class Keyboard implements InputDevice {
private BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
@Override
public String getInput() {
@@ -101,7 +102,7 @@ public void process(String input) {
System.out.println(input);
}
});
- app.readInputFrom(new ConsoleKeyboard());
+ app.readInputFrom(new Keyboard());
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.