ups
parent
ad90a0e496
commit
6fa3bc2d2b
|
@ -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!";
|
||||
}
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue