Skip to content

Commit 8bd2c2d

Browse files
author
Julien Letrouit
committed
Fixed unit tests
1 parent 86977b5 commit 8bd2c2d

4 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/main/java/engine/Texts.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ public class Texts {
133133
local("Expected to see '%s' in the console when calling %s, but saw '%s' instead!")
134134
.fr("Attendu à voir '%s' dans la console en appelant %s, mais vu '%s' à la place!");
135135
public static Localizable<String> OK_DISPLAYED_IN_CONSOLE =
136-
local("Ok: displayed '%s' in the console%s.")
137-
.fr("Ok: affiché '%s' dans la console%s.");
136+
local("Ok: displayed '%s' in the console when calling %s.")
137+
.fr("Ok: affiché '%s' dans la console en appelant %s.");
138138
public static Localizable<String> EXPECTED_TO_SEE_NOTHING_IN_CONSOLE_BUT_SAW_INSTEAD =
139139
local("Expected to not see anything more in the console when calling %s, but saw '%s' instead!")
140140
.fr("Attendu à ne plus rien voir dans la console en appelant %s, mais vu '%s' à la place!");

src/main/java/engine/test/ConsoleUnitTests.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
package engine.test;
22

3+
import static engine.Assertions.assertKoanMethodIsInvokable;
34
import static engine.Assertions.assertNextStdOutLineEquals;
45
import static engine.Assertions.assertNoMoreLineInStdOut;
6+
import static engine.ConsoleFmt.code;
7+
import static engine.ConsoleFmt.format;
58
import static engine.Localizable.global;
69

710
import java.util.List;
811

912
import engine.ConsoleFmt;
1013
import engine.Koan;
1114
import engine.Localizable;
15+
import engine.ConsoleFmt.Formats;
1216
import engine.test.simulation.StudentSolutions;
1317
import static engine.script.Expression.callKoanMethod;
1418
import static engine.Texts.*;
@@ -22,18 +26,20 @@ public class ConsoleUnitTests {
2226
new UnitTest(
2327
new Koan(CLASS, global("simpleConsoleOutput()"))
2428
.useConsole()
29+
.beforeFirstTest(assertKoanMethodIsInvokable("simpleConsoleOutput"))
2530
.when(callKoanMethod("simpleConsoleOutput"))
2631
.then(
2732
assertNextStdOutLineEquals(global("hello")),
2833
assertNoMoreLineInStdOut()
2934
),
3035
assertSuccess(
31-
new Line.Localized(ConsoleFmt.green(OK_DISPLAYED_IN_CONSOLE), "hello", "")
36+
new Line.Localized(format(OK_DISPLAYED_IN_CONSOLE, Formats.Green, "hello", code("simpleConsoleOutput()")))
3237
)
3338
),
3439
new UnitTest(
3540
new Koan(CLASS, global("noMethod"))
3641
.useConsole()
42+
.beforeFirstTest(assertKoanMethodIsInvokable("noMethod"))
3743
.when(callKoanMethod("noMethod"))
3844
.then(
3945
assertNextStdOutLineEquals(global("hello"))

src/main/java/koans/english/AboutConsoleAndVariables.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class AboutConsoleAndVariables {
2828
*
2929
*/
3030
public static void sayHelloInConsole() {
31-
System.out.println("Hello!");
31+
3232
}
3333

3434
/**

src/main/java/koans/french/AboutConsoleAndVariables.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class AboutConsoleAndVariables {
2828
*
2929
*/
3030
public static void sayHelloInConsole() {
31-
System.out.println("Hello!");
31+
3232
}
3333

3434
/**

0 commit comments

Comments
 (0)