@Test public void create_ProfileIsWifi() { ProfileWiFi profile03 = mock(ProfileWiFi.class); when(profile03.getProfileType()).thenReturn(ProfileType.WIFI); List<PacketInfo> packetlist = new ArrayList<PacketInfo>(); double traceDuration = 1000.0; when(profile03.getWifiTailTime()).thenReturn(1500.0); when(pktInfoArray[0].getTimeStamp()).thenReturn(date.getTime() - 1500.0); when(pktInfoArray[1].getTimeStamp()).thenReturn(date.getTime() - 500.0); when(pktInfoArray[2].getTimeStamp()).thenReturn(date.getTime() + 500.0); when(pktInfoArray[3].getTimeStamp()).thenReturn(date.getTime() + 1500.0); when(pktInfoArray[4].getTimeStamp()).thenReturn(date.getTime() + 2505.0); when(pktInfoArray[5].getTimeStamp()).thenReturn(date.getTime() + 3500.0); when(pktInfoArray[6].getTimeStamp()).thenReturn(date.getTime() + 4501.0); when(pktInfoArray[7].getTimeStamp()).thenReturn(date.getTime() + 5001.0); when(pktInfoArray[8].getTimeStamp()).thenReturn(date.getTime() + 6001.0); when(pktInfoArray[9].getTimeStamp()).thenReturn(date.getTime() + 6501.0); when(pktInfoArray[10].getTimeStamp()).thenReturn(date.getTime() + 7001.0); when(pktInfoArray[11].getTimeStamp()).thenReturn(date.getTime() + 9000.0); when(pktInfoArray[12].getTimeStamp()).thenReturn(date.getTime() + 9900.0); when(pktInfoArray[13].getTimeStamp()).thenReturn(date.getTime() + 15500.0); when(pktInfoArray[14].getTimeStamp()).thenReturn(date.getTime() + 25005.0); when(pktInfoArray[15].getTimeStamp()).thenReturn(date.getTime() + 36500.0); when(pktInfoArray[16].getTimeStamp()).thenReturn(date.getTime() + 47501.0); when(pktInfoArray[17].getTimeStamp()).thenReturn(date.getTime() + 57601.0); when(pktInfoArray[18].getTimeStamp()).thenReturn(date.getTime() + 107001.0); when(pktInfoArray[19].getTimeStamp()).thenReturn(date.getTime() + 216001.0); for (int i = 0; i < 20; i++) { packetlist.add(pktInfoArray[i]); } List<RrcStateRange> testList = rrcStateRangeFactory.create(packetlist, profile03, traceDuration); assertEquals(26, testList.size()); }
@Override public List<RrcStateRange> create(List<PacketInfo> packetlist, Profile profile, double traceDuration) { if(profile.getProfileType() == ProfileType.T3G){ Profile3G prof = (Profile3G)profile; return this.create3G(packetlist, prof, traceDuration); }else if(profile.getProfileType() == ProfileType.WIFI){ ProfileWiFi prof = (ProfileWiFi)profile; return this.createWiFi(packetlist, prof, traceDuration); }else if(profile.getProfileType() == ProfileType.LTE){ ProfileLTE prof = (ProfileLTE)profile; return this.createLTE(packetlist, prof, traceDuration); }else{ throw new IllegalArgumentException("Invalid profile type for state machine: " + profile.getClass()); } }
RrcStateRangeFactoryImpl implements IRrcStateRangeFactory { @Override public List<RrcStateRange> create(List<PacketInfo> packetlist, Profile profile, double traceDuration) { if(profile.getProfileType() == ProfileType.T3G){ Profile3G prof = (Profile3G)profile; return this.create3G(packetlist, prof, traceDuration); }else if(profile.getProfileType() == ProfileType.WIFI){ ProfileWiFi prof = (ProfileWiFi)profile; return this.createWiFi(packetlist, prof, traceDuration); }else if(profile.getProfileType() == ProfileType.LTE){ ProfileLTE prof = (ProfileLTE)profile; return this.createLTE(packetlist, prof, traceDuration); }else{ throw new IllegalArgumentException("Invalid profile type for state machine: " + profile.getClass()); } } }
RrcStateRangeFactoryImpl implements IRrcStateRangeFactory { @Override public List<RrcStateRange> create(List<PacketInfo> packetlist, Profile profile, double traceDuration) { if(profile.getProfileType() == ProfileType.T3G){ Profile3G prof = (Profile3G)profile; return this.create3G(packetlist, prof, traceDuration); }else if(profile.getProfileType() == ProfileType.WIFI){ ProfileWiFi prof = (ProfileWiFi)profile; return this.createWiFi(packetlist, prof, traceDuration); }else if(profile.getProfileType() == ProfileType.LTE){ ProfileLTE prof = (ProfileLTE)profile; return this.createLTE(packetlist, prof, traceDuration); }else{ throw new IllegalArgumentException("Invalid profile type for state machine: " + profile.getClass()); } }  }
RrcStateRangeFactoryImpl implements IRrcStateRangeFactory { @Override public List<RrcStateRange> create(List<PacketInfo> packetlist, Profile profile, double traceDuration) { if(profile.getProfileType() == ProfileType.T3G){ Profile3G prof = (Profile3G)profile; return this.create3G(packetlist, prof, traceDuration); }else if(profile.getProfileType() == ProfileType.WIFI){ ProfileWiFi prof = (ProfileWiFi)profile; return this.createWiFi(packetlist, prof, traceDuration); }else if(profile.getProfileType() == ProfileType.LTE){ ProfileLTE prof = (ProfileLTE)profile; return this.createLTE(packetlist, prof, traceDuration); }else{ throw new IllegalArgumentException("Invalid profile type for state machine: " + profile.getClass()); } }  @Override List<RrcStateRange> create(List<PacketInfo> packetlist,
			Profile profile, double traceDuration); }
RrcStateRangeFactoryImpl implements IRrcStateRangeFactory { @Override public List<RrcStateRange> create(List<PacketInfo> packetlist, Profile profile, double traceDuration) { if(profile.getProfileType() == ProfileType.T3G){ Profile3G prof = (Profile3G)profile; return this.create3G(packetlist, prof, traceDuration); }else if(profile.getProfileType() == ProfileType.WIFI){ ProfileWiFi prof = (ProfileWiFi)profile; return this.createWiFi(packetlist, prof, traceDuration); }else if(profile.getProfileType() == ProfileType.LTE){ ProfileLTE prof = (ProfileLTE)profile; return this.createLTE(packetlist, prof, traceDuration); }else{ throw new IllegalArgumentException("Invalid profile type for state machine: " + profile.getClass()); } }  @Override List<RrcStateRange> create(List<PacketInfo> packetlist,
			Profile profile, double traceDuration);  }