use of com.att.aro.core.packetanalysis.pojo.Throughput in project VideoOptimzer by attdevsupport.
the class ThroughputCalculatorImplTest method calculateThroughput_a.
@Test
public void calculateThroughput_a() {
Date date = new Date();
List<Throughput> testResult = new ArrayList<Throughput>();
List<PacketInfo> packets = new ArrayList<PacketInfo>();
PacketInfo pktInfo01 = Mockito.mock(PacketInfo.class);
Mockito.when(pktInfo01.getDir()).thenReturn(PacketDirection.UPLINK);
Mockito.when(pktInfo01.getTimeStamp()).thenReturn(date.getTime() + 5000.0);
packets.add(pktInfo01);
PacketInfo pktInfo02 = Mockito.mock(PacketInfo.class);
Mockito.when(pktInfo02.getDir()).thenReturn(PacketDirection.DOWNLINK);
Mockito.when(pktInfo02.getTimeStamp()).thenReturn(date.getTime() + 8000.0);
packets.add(pktInfo02);
PacketInfo pktInfo03 = Mockito.mock(PacketInfo.class);
Mockito.when(pktInfo03.getDir()).thenReturn(PacketDirection.UPLINK);
Mockito.when(pktInfo03.getTimeStamp()).thenReturn(date.getTime() + 22000.0);
packets.add(pktInfo03);
PacketInfo pktInfo04 = Mockito.mock(PacketInfo.class);
Mockito.when(pktInfo04.getDir()).thenReturn(PacketDirection.UPLINK);
Mockito.when(pktInfo04.getTimeStamp()).thenReturn(date.getTime() + 23000.0);
packets.add(pktInfo04);
PacketInfo pktInfo05 = Mockito.mock(PacketInfo.class);
Mockito.when(pktInfo05.getDir()).thenReturn(PacketDirection.UPLINK);
Mockito.when(pktInfo05.getTimeStamp()).thenReturn(date.getTime() + 70000.0);
packets.add(pktInfo05);
PacketInfo pktInfo06 = Mockito.mock(PacketInfo.class);
Mockito.when(pktInfo06.getDir()).thenReturn(PacketDirection.UPLINK);
Mockito.when(pktInfo06.getTimeStamp()).thenReturn(date.getTime() + 72000.0);
packets.add(pktInfo06);
testResult = throughputCalculator.calculateThroughput(date.getTime() + 0.0, date.getTime() + 100000.0, 15000.0, packets);
assertEquals(7, testResult.size());
}
Aggregations