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)); + } +}