From 6fa3bc2d2b16783b2879ed660fa7d567572cc297 Mon Sep 17 00:00:00 2001 From: 2wenty1ne Date: Thu, 21 Nov 2024 15:35:21 +0100 Subject: [PATCH] ups --- tests/src/files/Ausleihe.java | 23 +++++++++++++++++++++++ tests/tests/files/tests.java | 14 ++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/src/files/Ausleihe.java create mode 100644 tests/tests/files/tests.java diff --git a/tests/src/files/Ausleihe.java b/tests/src/files/Ausleihe.java new file mode 100644 index 0000000..184167d --- /dev/null +++ b/tests/src/files/Ausleihe.java @@ -0,0 +1,23 @@ +package files; + +public class Ausleihe { + public boolean isSignedIn; + public boolean mediumAvailable; + + public Ausleihe (boolean isSignedIn, boolean mediumAvailable) { + this.isSignedIn = isSignedIn; + this.mediumAvailable = mediumAvailable; + } + + public String borrowMedium() { + if (!isSignedIn) { + return "Not signed in, returning"; + } + + if (!mediumAvailable) { + return "Medium is not available, pick a different one"; + } + + return "Borrowed medium!"; + } +} diff --git a/tests/tests/files/tests.java b/tests/tests/files/tests.java new file mode 100644 index 0000000..3a3d388 --- /dev/null +++ b/tests/tests/files/tests.java @@ -0,0 +1,14 @@ +package files; + +import static org.junit.jupiter.api.Assertions.*; + +public class tests { + @org.junit.jupiter.api.Test + void unitTest() { + Ausleihe ausleihe = new Ausleihe(true, true); + + String expectedString = "Borrowed medium!"; + + assertTrue(ausleihe.borrowMedium().equals(expectedString)); + } +}