From accd0e08b6c9a9e6d58d66160b81bde9254eb725 Mon Sep 17 00:00:00 2001 From: fdai7487 Date: Fri, 10 Feb 2023 23:37:53 +0100 Subject: [PATCH] added first Unittest --- .../digital/technik/DigitalTechnikTest.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/java/digital/technik/DigitalTechnikTest.java diff --git a/src/main/java/digital/technik/DigitalTechnikTest.java b/src/main/java/digital/technik/DigitalTechnikTest.java new file mode 100644 index 0000000..b92ab46 --- /dev/null +++ b/src/main/java/digital/technik/DigitalTechnikTest.java @@ -0,0 +1,29 @@ +package digital.technik; + +import org.junit.jupiter.api.Test; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import static org.junit.jupiter.api.Assertions.assertTrue; + + +class DigitalTechnikTest { + + + @Test + public void testDigitalTechnik1() { + String input = "3\n"; + ByteArrayInputStream in = new ByteArrayInputStream(input.getBytes()); + System.setIn(in); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + System.setOut(new PrintStream(out)); + + DigitalTechnik digitalTechnik = new DigitalTechnik(); + digitalTechnik.digitalTechnik1(); + + assertTrue(out.toString().contains("Die Zuordnung muss nicht (eindeutig) umkehrbar sein!")); + } +} \ No newline at end of file