Added final eating Philosopher
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package Praktikum03;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
class ForkTest {
|
||||
|
||||
@Test
|
||||
void getId() {
|
||||
Fork fork = new Fork(1);
|
||||
assertEquals(1, fork.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void take() throws InterruptedException {
|
||||
Fork fork = new Fork(2);
|
||||
assertTrue(fork.take());
|
||||
assertFalse(fork.take());
|
||||
fork.put();
|
||||
assertTrue(fork.take());
|
||||
}
|
||||
|
||||
@Test
|
||||
void put() throws InterruptedException {
|
||||
Fork fork = new Fork(3);
|
||||
fork.take();
|
||||
fork.put();
|
||||
assertFalse(fork.isInUse());
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user