Esp2Connection extends AbstractConnection<Esp2Packet, Esp2Request> implements Esp2ProcessorListener { @Override public void radioTelegramReceived(EspRadioTelegram telegram) { if(radioListener != null) { radioListener.radioTelegramReceived(telegram); } } Esp2Connection(EspProcessor<Esp2Packet> processor, RadioTelegramListener listener); @Override void radioTelegramReceived(EspRadioTelegram telegram);  }
@Test public void testRadioTelegramListener() throws Exception { Esp2Connection conn = new Esp2Connection(mockProcessor, mockListener); Esp21BSTelegram telegram = new Esp21BSTelegram(DeviceID.fromString("0xFF800000"), (byte)0x00, (byte)0x00); Assert.assertNull(mockListener.receivedTelegram); conn.radioTelegramReceived(telegram); Assert.assertEquals(telegram.getSenderID(), mockListener.receivedTelegram.getSenderID()); Assert.assertEquals(telegram.getRORG(), mockListener.receivedTelegram.getRORG()); Assert.assertArrayEquals(telegram.getPayload(), mockListener.receivedTelegram.getPayload()); Assert.assertEquals(telegram.getStatusByte(), mockListener.receivedTelegram.getStatusByte()); }