Skip to content

Commit

Permalink
[#278] fixing output 30,31,33 lessons
Browse files Browse the repository at this point in the history
  • Loading branch information
unsigable committed Sep 22, 2024
1 parent f155ee8 commit dfa1182
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
7 changes: 5 additions & 2 deletions modules/35-methods-using/100-methods/Test.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import java.io.ByteArrayOutputStream;
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.PrintStream;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -7,15 +9,16 @@ class Test {
public static void main(String[] args) {
final var expected = "12";

App.main(null);

ByteArrayOutputStream out = new ByteArrayOutputStream();
System.setOut(new PrintStream(out));

App.main(null);

final var actual = out.toString().trim();

System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
System.out.println(actual);

assertThat(actual).isEqualTo(expected);
}
}
7 changes: 5 additions & 2 deletions modules/35-methods-using/105-methods-parameters/Test.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import java.io.ByteArrayOutputStream;
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.PrintStream;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -7,15 +9,16 @@ class Test {
public static void main(String[] args) {
final var expected = "h o d o r";

App.main(null);

ByteArrayOutputStream out = new ByteArrayOutputStream();
System.setOut(new PrintStream(out));

App.main(null);

final var actual = out.toString().trim();

System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
System.out.println(actual);

assertThat(actual).isEqualTo(expected);
}
}
7 changes: 5 additions & 2 deletions modules/35-methods-using/115-string-immutability/Test.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import java.io.ByteArrayOutputStream;
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.PrintStream;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -7,15 +9,16 @@ class Test {
public static void main(String[] args) {
final var expected = "[email protected]";

App.main(null);

ByteArrayOutputStream out = new ByteArrayOutputStream();
System.setOut(new PrintStream(out));

App.main(null);

final var actual = out.toString().trim();

System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
System.out.println(actual);

assertThat(actual).isEqualTo(expected);
}
}

0 comments on commit dfa1182

Please sign in to comment.