@Test public void create_T3GStateIsPROMO_IDLE_DCH() { List<PacketInfo> packetlist1 = new ArrayList<PacketInfo>(); when(profilefactory.energy3G(any(double.class), any(double.class), any(RRCState.class), any(Profile3G.class))) .thenReturn(100.0); Profile3G profile14 = mock(Profile3G.class); when(profile14.getProfileType()).thenReturn(ProfileType.T3G); 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.PROMO_IDLE_DCH); when(rrcStateRangeArray[i].getBeginTime()).thenReturn((double) date.getTime() + 2 * i * 500); when(rrcStateRangeArray[i].getEndTime()).thenReturn((double) date.getTime() + (2 * i + 1) * 500.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); RrcStateMachine3G rrcStateMachine3G = (RrcStateMachine3G) machineFactoryimpl.create(packetlist1, profile14, packetDuration, traceDuration, totalBytes * 100, null); assertEquals(50.0, rrcStateMachine3G.getJoulesPerKilobyte(), 0.0); assertEquals(5, rrcStateMachine3G.getIdleToDch(), 0.0); assertEquals(2500, rrcStateMachine3G.getIdleToDchTime(), 0.0); assertEquals(500, rrcStateMachine3G.getIdleToDchEnergy(), 0.0); }
@Override public AbstractRrcStateMachine create(List<PacketInfo> packetlist, Profile profile, double packetDuration, double traceDuration, double totalBytes, TimeRange timerange) { List<RrcStateRange> staterangelist = staterange.create(packetlist, profile, traceDuration); if(timerange != null){ staterangelist = this.getRRCStatesForTheTimeRange(staterangelist, timerange.getBeginTime(), timerange.getEndTime()); } AbstractRrcStateMachine data = null; if(profile.getProfileType() == ProfileType.T3G){ data = run3GRRcStatistics(staterangelist, (Profile3G)profile, totalBytes, packetDuration, traceDuration); }else if(profile.getProfileType() == ProfileType.LTE){ data = runLTERRcStatistics(staterangelist, (ProfileLTE)profile, packetlist, totalBytes, packetDuration, traceDuration); }else if(profile.getProfileType() == ProfileType.WIFI){ data = runWiFiRRcStatistics(staterangelist, (ProfileWiFi)profile, totalBytes, packetDuration, traceDuration); } if(data != null){ data.setStaterangelist(staterangelist); } return data; }
RrcStateMachineFactoryImpl implements IRrcStateMachineFactory { @Override public AbstractRrcStateMachine create(List<PacketInfo> packetlist, Profile profile, double packetDuration, double traceDuration, double totalBytes, TimeRange timerange) { List<RrcStateRange> staterangelist = staterange.create(packetlist, profile, traceDuration); if(timerange != null){ staterangelist = this.getRRCStatesForTheTimeRange(staterangelist, timerange.getBeginTime(), timerange.getEndTime()); } AbstractRrcStateMachine data = null; if(profile.getProfileType() == ProfileType.T3G){ data = run3GRRcStatistics(staterangelist, (Profile3G)profile, totalBytes, packetDuration, traceDuration); }else if(profile.getProfileType() == ProfileType.LTE){ data = runLTERRcStatistics(staterangelist, (ProfileLTE)profile, packetlist, totalBytes, packetDuration, traceDuration); }else if(profile.getProfileType() == ProfileType.WIFI){ data = runWiFiRRcStatistics(staterangelist, (ProfileWiFi)profile, totalBytes, packetDuration, traceDuration); } if(data != null){ data.setStaterangelist(staterangelist); } return data; } }
RrcStateMachineFactoryImpl implements IRrcStateMachineFactory { @Override public AbstractRrcStateMachine create(List<PacketInfo> packetlist, Profile profile, double packetDuration, double traceDuration, double totalBytes, TimeRange timerange) { List<RrcStateRange> staterangelist = staterange.create(packetlist, profile, traceDuration); if(timerange != null){ staterangelist = this.getRRCStatesForTheTimeRange(staterangelist, timerange.getBeginTime(), timerange.getEndTime()); } AbstractRrcStateMachine data = null; if(profile.getProfileType() == ProfileType.T3G){ data = run3GRRcStatistics(staterangelist, (Profile3G)profile, totalBytes, packetDuration, traceDuration); }else if(profile.getProfileType() == ProfileType.LTE){ data = runLTERRcStatistics(staterangelist, (ProfileLTE)profile, packetlist, totalBytes, packetDuration, traceDuration); }else if(profile.getProfileType() == ProfileType.WIFI){ data = runWiFiRRcStatistics(staterangelist, (ProfileWiFi)profile, totalBytes, packetDuration, traceDuration); } if(data != null){ data.setStaterangelist(staterangelist); } return data; }  }
RrcStateMachineFactoryImpl implements IRrcStateMachineFactory { @Override public AbstractRrcStateMachine create(List<PacketInfo> packetlist, Profile profile, double packetDuration, double traceDuration, double totalBytes, TimeRange timerange) { List<RrcStateRange> staterangelist = staterange.create(packetlist, profile, traceDuration); if(timerange != null){ staterangelist = this.getRRCStatesForTheTimeRange(staterangelist, timerange.getBeginTime(), timerange.getEndTime()); } AbstractRrcStateMachine data = null; if(profile.getProfileType() == ProfileType.T3G){ data = run3GRRcStatistics(staterangelist, (Profile3G)profile, totalBytes, packetDuration, traceDuration); }else if(profile.getProfileType() == ProfileType.LTE){ data = runLTERRcStatistics(staterangelist, (ProfileLTE)profile, packetlist, totalBytes, packetDuration, traceDuration); }else if(profile.getProfileType() == ProfileType.WIFI){ data = runWiFiRRcStatistics(staterangelist, (ProfileWiFi)profile, totalBytes, packetDuration, traceDuration); } if(data != null){ data.setStaterangelist(staterangelist); } return data; }  @Override AbstractRrcStateMachine create(List<PacketInfo> packetlist,
			Profile profile, double packetDuration, double traceDuration, double totalBytes,
			TimeRange timerange); }
RrcStateMachineFactoryImpl implements IRrcStateMachineFactory { @Override public AbstractRrcStateMachine create(List<PacketInfo> packetlist, Profile profile, double packetDuration, double traceDuration, double totalBytes, TimeRange timerange) { List<RrcStateRange> staterangelist = staterange.create(packetlist, profile, traceDuration); if(timerange != null){ staterangelist = this.getRRCStatesForTheTimeRange(staterangelist, timerange.getBeginTime(), timerange.getEndTime()); } AbstractRrcStateMachine data = null; if(profile.getProfileType() == ProfileType.T3G){ data = run3GRRcStatistics(staterangelist, (Profile3G)profile, totalBytes, packetDuration, traceDuration); }else if(profile.getProfileType() == ProfileType.LTE){ data = runLTERRcStatistics(staterangelist, (ProfileLTE)profile, packetlist, totalBytes, packetDuration, traceDuration); }else if(profile.getProfileType() == ProfileType.WIFI){ data = runWiFiRRcStatistics(staterangelist, (ProfileWiFi)profile, totalBytes, packetDuration, traceDuration); } if(data != null){ data.setStaterangelist(staterangelist); } return data; }  @Override AbstractRrcStateMachine create(List<PacketInfo> packetlist,
			Profile profile, double packetDuration, double traceDuration, double totalBytes,
			TimeRange timerange);  }