use of com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi in project VideoOptimzer by attdevsupport.
the class RrcStateMachineFactoryImplTest method create_WIFIStateIsWIFI_TAIL.
@Test
public void create_WIFIStateIsWIFI_TAIL() {
ProfileWiFi profile17 = mock(ProfileWiFi.class);
when(profile17.getProfileType()).thenReturn(ProfileType.WIFI);
when(profilefactory.energyWiFi(any(double.class), any(double.class), any(RRCState.class), any(ProfileWiFi.class))).thenReturn(100.0);
List<PacketInfo> packetlist1 = new ArrayList<PacketInfo>();
List<RrcStateRange> staterangelist = new ArrayList<RrcStateRange>();
RrcStateRange[] rrcStateRangeArray = new RrcStateRange[5];
for (int i = 0; i < 5; i++) {
rrcStateRangeArray[i] = mock(RrcStateRange.class);
when(rrcStateRangeArray[i].getState()).thenReturn(RRCState.WIFI_TAIL);
when(rrcStateRangeArray[i].getBeginTime()).thenReturn((double) date.getTime() + 2 * i * 1000);
when(rrcStateRangeArray[i].getEndTime()).thenReturn((double) date.getTime() + (2 * i + 1) * 1000.0);
}
for (int i = 0; i < 5; i++) {
staterangelist.add(rrcStateRangeArray[i]);
}
when(staterange.create(any(ArrayList.class), any(Profile.class), any(double.class))).thenReturn(staterangelist);
RrcStateMachineWiFi rrcStateMachineWifi = (RrcStateMachineWiFi) machineFactoryimpl.create(packetlist1, profile17, packetDuration, traceDuration, totalBytes * 100, null);
assertEquals(50, rrcStateMachineWifi.getJoulesPerKilobyte(), 0.0);
assertEquals(500, rrcStateMachineWifi.getWifiTailEnergy(), 0.0);
assertEquals(5000, rrcStateMachineWifi.getWifiTailTime(), 0.0);
}
Aggregations