updated tests and split some tests

This commit is contained in:
Lucas Pleß 2012-03-06 17:29:57 +01:00
parent 43543682f9
commit 8cd211e6d9
1 changed files with 23 additions and 4 deletions

View File

@ -88,19 +88,28 @@ public class BuntiDMXDeviceTest {
assertEquals(dut.getChannelValueByName("nonexistent"),0 );
}
@Test
public void testGetChannelData() throws Exception {
private Map<String, Object> createOptions() {
Map<String, Object> options = new HashMap<String, Object>();
options.put("blue", 99);
options.put("red", 66);
options.put("green", 77);
options.put("speed", 111);
options.put("mode", 222);
return options;
}
assertTrue(dut.setValuesFromOptions(options));
@Test
public void testGetChannelDataCount() throws Exception {
dut.setValuesFromOptions(createOptions());
Map<Integer,Integer> channelData = dut.getChannelData();
assertEquals(channelData.size(), 5);
}
@Test
public void testGetChannelDataOrder() throws Exception {
dut.setValuesFromOptions(createOptions());
Map<Integer,Integer> channelData = dut.getChannelData();
assertEquals(new Integer(222), channelData.get(STARTADDRESS + 0 + DMX.DMX_STARTADDRESS_OFFSET));
assertEquals(new Integer(66), channelData.get(STARTADDRESS + 1 + DMX.DMX_STARTADDRESS_OFFSET));
@ -116,4 +125,14 @@ public class BuntiDMXDeviceTest {
assertEquals(6, channelData.size());
}
@Test
public void testGetLastChanged() throws Exception {
assert(dut.getLastChanged() > 0);
}
@Test
public void testSetDeviceName() throws Exception {
dut.setDeviceName("rapunzel");
assertEquals("rapunzel", dut.getDeviceName());
}
}