From 5c823b8a6ee006cd0fd49d0f94ac2d0cac4f4e3e Mon Sep 17 00:00:00 2001 From: fdai7487 Date: Fri, 10 Feb 2023 20:53:55 +0100 Subject: [PATCH] Unittest: added Unittest Digitaltechnik1 --- src/digital/technik/DigitalTechnikTest.java | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/digital/technik/DigitalTechnikTest.java diff --git a/src/digital/technik/DigitalTechnikTest.java b/src/digital/technik/DigitalTechnikTest.java new file mode 100644 index 0000000..b92ab46 --- /dev/null +++ b/src/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