123 lines
2.9 KiB
Java
123 lines
2.9 KiB
Java
package de.ctdo.bunti.model;
|
|
|
|
import org.junit.Before;
|
|
import org.junit.Test;
|
|
|
|
import static junit.framework.Assert.*;
|
|
|
|
public class Strobe1500Test {
|
|
Strobe1500 dut;
|
|
|
|
@Before
|
|
public void setUp() throws Exception {
|
|
dut = new Strobe1500();
|
|
dut.setId(23);
|
|
dut.setStartAddress(42);
|
|
dut.setDeviceName("device");
|
|
}
|
|
|
|
@Test
|
|
public void testSetSpeed1() throws Exception {
|
|
assertTrue(dut.setSpeed(0));
|
|
}
|
|
@Test
|
|
public void testSetSpeed2() throws Exception {
|
|
assertTrue(dut.setSpeed(128));
|
|
}
|
|
@Test
|
|
public void testSetSpeed3() throws Exception {
|
|
assertTrue(dut.setSpeed(255));
|
|
}
|
|
|
|
@Test
|
|
public void testGetSpeed1() throws Exception {
|
|
dut.setSpeed(0);
|
|
assertEquals(0,dut.getSpeed());
|
|
}
|
|
@Test
|
|
public void testGetSpeed2() throws Exception {
|
|
dut.setSpeed(128);
|
|
assertEquals(128,dut.getSpeed());
|
|
}
|
|
@Test
|
|
public void testGetSpeed3() throws Exception {
|
|
dut.setSpeed(255);
|
|
assertEquals(255,dut.getSpeed());
|
|
}
|
|
|
|
@Test
|
|
public void testIntensity1() throws Exception {
|
|
dut.setIntensity(0);
|
|
assertEquals(0,dut.getIntensity());
|
|
}
|
|
@Test
|
|
public void testIntensity2() throws Exception {
|
|
dut.setIntensity(128);
|
|
assertEquals(128,dut.getIntensity());
|
|
}
|
|
@Test
|
|
public void testIntensity3() throws Exception {
|
|
dut.setIntensity(255);
|
|
assertEquals(255,dut.getIntensity());
|
|
}
|
|
|
|
@Test
|
|
public void testMode1() throws Exception {
|
|
dut.setMode(0);
|
|
assertEquals(0,dut.getMode());
|
|
}
|
|
@Test
|
|
public void testMode2() throws Exception {
|
|
dut.setMode(128);
|
|
assertEquals(128,dut.getMode());
|
|
}
|
|
@Test
|
|
public void testMode3() throws Exception {
|
|
dut.setMode(255);
|
|
assertEquals(255,dut.getMode());
|
|
}
|
|
|
|
@Test
|
|
public void testSwitchOffSpeed() throws Exception {
|
|
dut.switchOff();
|
|
assertEquals(0,dut.getSpeed());
|
|
}
|
|
@Test
|
|
public void testSwitchOffIntensity() throws Exception {
|
|
dut.switchOff();
|
|
assertEquals(0,dut.getIntensity());
|
|
}
|
|
@Test
|
|
public void testSwitchOffMode() throws Exception {
|
|
dut.switchOff();
|
|
assertEquals(0,dut.getMode());
|
|
}
|
|
|
|
@Test
|
|
public void testSwitchOnSpeed() throws Exception {
|
|
dut.switchOn();
|
|
assertEquals(255,dut.getSpeed());
|
|
}
|
|
|
|
@Test
|
|
public void testSwitchOnIntensity() throws Exception {
|
|
dut.switchOn();
|
|
assertEquals(255,dut.getIntensity());
|
|
}
|
|
|
|
@Test
|
|
public void testSwitchOnMode() throws Exception {
|
|
dut.switchOn();
|
|
assertEquals(0,dut.getMode());
|
|
}
|
|
|
|
@Test
|
|
public void testToString() throws Exception {
|
|
dut.setSpeed(123);
|
|
dut.setIntensity(111);
|
|
dut.setMode(42);
|
|
assertEquals("Strobe1500 23, device [123,111,42]", dut.toString());
|
|
}
|
|
|
|
}
|