@Test public void testTriggerIsolated() { NetworkDevice networkDevice = mock(NetworkDevice.class); PacketArrivalEvent event = new PacketArrivalEvent(1000, packet, networkDevice); event.trigger(); verify(networkDevice, times(1)).receive(packet); }
@Override public void trigger() { arrivalNetworkDevice.receive(packet); }
PacketArrivalEvent extends Event { @Override public void trigger() { arrivalNetworkDevice.receive(packet); } }
PacketArrivalEvent extends Event { @Override public void trigger() { arrivalNetworkDevice.receive(packet); } PacketArrivalEvent(long timeFromNowNs, Packet packet, NetworkDevice arrivalNetworkDevice); }
PacketArrivalEvent extends Event { @Override public void trigger() { arrivalNetworkDevice.receive(packet); } PacketArrivalEvent(long timeFromNowNs, Packet packet, NetworkDevice arrivalNetworkDevice); @Override void trigger(); @Override String toString(); }
PacketArrivalEvent extends Event { @Override public void trigger() { arrivalNetworkDevice.receive(packet); } PacketArrivalEvent(long timeFromNowNs, Packet packet, NetworkDevice arrivalNetworkDevice); @Override void trigger(); @Override String toString();  }