2022-12-09 01:38:11 +01:00
|
|
|
package domain;
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
|
|
|
|
class C3POTest {
|
|
|
|
|
2022-12-20 12:03:41 +01:00
|
|
|
C3PO Herbert;
|
2022-12-09 01:38:11 +01:00
|
|
|
int id = 0;
|
|
|
|
String name = "Herbert";
|
|
|
|
|
|
|
|
@BeforeEach
|
|
|
|
void setup(){
|
|
|
|
Herbert = new C3PO(id, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Tests for basic functions
|
|
|
|
@Test
|
|
|
|
void getId() {
|
|
|
|
|
|
|
|
assertEquals(id, Herbert.getId());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void getName() {
|
|
|
|
assertEquals(name, Herbert.getName());
|
|
|
|
assertEquals(name,
|
|
|
|
Herbert.getName());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void triggerPowerSwitch() {
|
|
|
|
Herbert.triggerPowerSwitch();
|
|
|
|
assertTrue(Herbert.isPowerOn());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void isPowerOn() {
|
|
|
|
assertFalse(Herbert.isPowerOn());
|
|
|
|
Herbert.triggerPowerSwitch();
|
|
|
|
assertTrue(Herbert.isPowerOn());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|