2022-12-14 09:54:18 +01:00
|
|
|
package domain;
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
|
2022-12-08 23:34:47 +01:00
|
|
|
class R2D2Test {
|
2022-12-14 09:54:18 +01:00
|
|
|
|
|
|
|
R2D2 Herbert;
|
|
|
|
int id = 0;
|
|
|
|
String name = "Herbert";
|
|
|
|
@BeforeEach
|
|
|
|
void setup(){
|
|
|
|
Herbert = new R2D2(id, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Tests for basic functions
|
|
|
|
@Test
|
|
|
|
void getId() {
|
|
|
|
assertEquals(id, Herbert.getId());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void getName() {
|
|
|
|
assertEquals(name, Herbert.getName());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void triggerPowerSwitch() {
|
|
|
|
Herbert.triggerPowerSwitch();
|
|
|
|
assertTrue(Herbert.isPowerOn());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void isPowerOn() {
|
|
|
|
assertFalse(Herbert.isPowerOn());
|
|
|
|
Herbert.triggerPowerSwitch();
|
|
|
|
assertTrue(Herbert.isPowerOn());
|
|
|
|
}
|
|
|
|
|
2022-12-08 23:34:47 +01:00
|
|
|
}
|