added deviceId test. and ChannelValueWrong

This commit is contained in:
Lucas Pleß 2012-03-06 18:10:46 +01:00
parent 41452fab63
commit 3deb94652f
1 changed files with 14 additions and 2 deletions

View File

@ -13,11 +13,12 @@ import static org.junit.Assert.assertEquals;
public class BuntiDMXDeviceTest { public class BuntiDMXDeviceTest {
private static final int STARTADDRESS = 42; private static final int STARTADDRESS = 42;
private static final int DEVICEID = 23;
BuntiDMXDevice dut; BuntiDMXDevice dut;
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
dut = new Par56Spot(23,STARTADDRESS,"device"); dut = new Par56Spot(DEVICEID,STARTADDRESS,"device");
} }
@Test @Test
@ -88,6 +89,11 @@ public class BuntiDMXDeviceTest {
assertEquals(dut.getChannelValueByName("nonexistent"),0 ); assertEquals(dut.getChannelValueByName("nonexistent"),0 );
} }
@Test
public void testGetChannelValueWrong2() throws Exception {
assertEquals(dut.getChannelValueByName(null), 0);
}
private Map<String, Object> createOptions() { private Map<String, Object> createOptions() {
Map<String, Object> options = new HashMap<String, Object>(); Map<String, Object> options = new HashMap<String, Object>();
options.put("blue", 99); options.put("blue", 99);
@ -131,8 +137,14 @@ public class BuntiDMXDeviceTest {
} }
@Test @Test
public void testSetDeviceName() throws Exception { public void testSetDeviceName() throws Exception {
dut.setDeviceName("rapunzel"); dut.setDeviceName("rapunzel");
assertEquals("rapunzel", dut.getDeviceName()); assertEquals("rapunzel", dut.getDeviceName());
} }
@Test
public void testGetDeviceId() throws Exception {
assertEquals(DEVICEID, dut.getDeviceId());
}
} }