EepData { public byte[] asByteArray() throws EepOutOfRangeException { for(EepDataListener listener : listeners) { listener.updateData(this); } return data.clone(); } EepData(EepType type, int length, Set<EepDataListener> dataListeners);  EepData(EepType type, int length, EepDataListener...dataListeners); @Override String toString(); int length(); void setValue(int index, int value); int getValue(int index); byte[] asByteArray(); String dataAsString(); void update(byte[] eepData);  }
@Test public void testBasicConstruction() throws Exception { int dataLength = 4; EepData data = new EepData(EepType.EEP_TYPE_A50205, dataLength, dataListeners); Assert.assertArrayEquals(new byte[dataLength], data.asByteArray()); data = new EepData(EepType.EEP_TYPE_A50205, dataLength, dataListener1, dataListener2); Assert.assertArrayEquals(new byte[dataLength], data.asByteArray()); }
@Test public void testNullDataListeners() throws Exception { EepData data = new EepData(EepType.EEP_TYPE_A50205, 4, (EepDataListener)null); Assert.assertArrayEquals(new byte[4], data.asByteArray()); data = new EepData(EepType.EEP_TYPE_A50205, 4, (Set<EepDataListener>)null); Assert.assertArrayEquals(new byte[4], data.asByteArray()); }