2wenty1ne 2024-11-21 15:35:21 +01:00
parent ad90a0e496
commit 6fa3bc2d2b
2 changed files with 37 additions and 0 deletions

View File

@ -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!";
}
}

View File

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