Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit cfa6c2a

Browse files
author
Aleksi Salmela
committed
Fix the message of TestIo prompt assert.
1 parent 8cffbcc commit cfa6c2a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/test/java/fi/helsinki/cs/tmc/cli/io/TestIo.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ private enum PromptType {
2424
private final LinkedList<String> textPrompts;
2525
private final LinkedList<String> passwordPrompts;
2626
private final LinkedList<Boolean> confirmationPrompts;
27-
private int expectedPromptCount;
27+
private int usedPromptCount;
2828

2929
public TestIo() {
3030
printedText = new StringBuilder();
3131
textPrompts = new LinkedList<>();
3232
promptOrder = new LinkedList<>();
3333
passwordPrompts = new LinkedList<>();
3434
confirmationPrompts = new LinkedList<>();
35-
expectedPromptCount = 0;
35+
usedPromptCount = 0;
3636
}
3737

3838
public void assertContains(String contains) {
@@ -55,9 +55,9 @@ public void assertAllPromptsUsed() {
5555
if (!allPromptsUsed()) {
5656
fail(
5757
"Program should have created "
58-
+ expectedPromptCount
59-
+ " prompts instead of "
6058
+ promptOrder.size()
59+
+ " prompts instead of "
60+
+ usedPromptCount
6161
+ " prompts.");
6262
}
6363
}
@@ -132,7 +132,6 @@ private <T> void addPrompt(PromptType type, T value) {
132132
break;
133133
}
134134
promptOrder.add(type);
135-
expectedPromptCount++;
136135
}
137136

138137
private void usePrompt(PromptType type) {
@@ -145,6 +144,7 @@ private void usePrompt(PromptType type) {
145144
throw new AssertionError(
146145
"Wrong prompt type expected " + expected.name() + ", got " + type);
147146
}
147+
usedPromptCount++;
148148
}
149149

150150
private boolean allPromptsUsed() {

0 commit comments

Comments
 (0)