@Test public void energy3G_RRCStateIsSTATE_IDLE(){ Profile3G profile3g = Mockito.mock(Profile3G.class); Mockito.when(profile3g.getPowerIdle()).thenReturn(0.2); double testResult = profilefactory .energy3G(date.getTime()+0.0, date.getTime()+1000.0, RRCState.STATE_IDLE, profile3g); assertEquals(200.0,testResult,0.0); }
@Override public double energy3G(double time1, double time2, RRCState state, Profile3G prof) { double deltaTime = time2 - time1; switch (state) { case STATE_DCH: case TAIL_DCH: return deltaTime * prof.getPowerDch(); case STATE_FACH: case TAIL_FACH: return deltaTime * prof.getPowerFach(); case STATE_IDLE: return deltaTime * prof.getPowerIdle(); case PROMO_IDLE_DCH: return deltaTime * prof.getPowerIdleDch(); case PROMO_FACH_DCH: return deltaTime * prof.getPowerFachDch(); default: assert (true); } return 0.0f; }
ProfileFactoryImpl implements IProfileFactory { @Override public double energy3G(double time1, double time2, RRCState state, Profile3G prof) { double deltaTime = time2 - time1; switch (state) { case STATE_DCH: case TAIL_DCH: return deltaTime * prof.getPowerDch(); case STATE_FACH: case TAIL_FACH: return deltaTime * prof.getPowerFach(); case STATE_IDLE: return deltaTime * prof.getPowerIdle(); case PROMO_IDLE_DCH: return deltaTime * prof.getPowerIdleDch(); case PROMO_FACH_DCH: return deltaTime * prof.getPowerFachDch(); default: assert (true); } return 0.0f; } }
ProfileFactoryImpl implements IProfileFactory { @Override public double energy3G(double time1, double time2, RRCState state, Profile3G prof) { double deltaTime = time2 - time1; switch (state) { case STATE_DCH: case TAIL_DCH: return deltaTime * prof.getPowerDch(); case STATE_FACH: case TAIL_FACH: return deltaTime * prof.getPowerFach(); case STATE_IDLE: return deltaTime * prof.getPowerIdle(); case PROMO_IDLE_DCH: return deltaTime * prof.getPowerIdleDch(); case PROMO_FACH_DCH: return deltaTime * prof.getPowerFachDch(); default: assert (true); } return 0.0f; }  }
ProfileFactoryImpl implements IProfileFactory { @Override public double energy3G(double time1, double time2, RRCState state, Profile3G prof) { double deltaTime = time2 - time1; switch (state) { case STATE_DCH: case TAIL_DCH: return deltaTime * prof.getPowerDch(); case STATE_FACH: case TAIL_FACH: return deltaTime * prof.getPowerFach(); case STATE_IDLE: return deltaTime * prof.getPowerIdle(); case PROMO_IDLE_DCH: return deltaTime * prof.getPowerIdleDch(); case PROMO_FACH_DCH: return deltaTime * prof.getPowerFachDch(); default: assert (true); } return 0.0f; }  @Override Profile create(ProfileType typeParm, Properties prop); @Override double energy3G(double time1, double time2, RRCState state, Profile3G prof); @Override Profile create3Gdefault(); @Override Profile create3GFromDefaultResourceFile(); @Override Profile create3GFromFilePath(String filepath); @Override Profile create3G(InputStream input); @Override Profile create3G(Properties properties); @Override void save3G(String filepath, Profile3G prof); @Override void save3G(OutputStream output, Profile3G prof); @Override double energyLTE(double time1, double time2, RRCState state, ProfileLTE prof, List<PacketInfo> packets); @Override Profile createLTEdefault(); @Override Profile createLTEFromDefaultResourceFile(); @Override Profile createLTEFromFilePath(String filepath); @Override Profile createLTE(InputStream input); @Override Profile createLTE(Properties properties); @Override void saveLTE(String filepath, ProfileLTE prof); @Override void saveLTE(OutputStream output, ProfileLTE prof); @Override double energyWiFi(double time1, double time2, RRCState state , ProfileWiFi prof); @Override Profile createWiFidefault(); @Override Profile createWiFiFromFilePath(String filepath); @Override Profile createWiFiFromDefaultResourceFile(); @Override Profile createWiFi(InputStream input); @Override Profile createWiFi(Properties properties); @Override void saveWiFi(String filepath, ProfileWiFi prof); @Override void saveWiFi(OutputStream output, ProfileWiFi prof); }
ProfileFactoryImpl implements IProfileFactory { @Override public double energy3G(double time1, double time2, RRCState state, Profile3G prof) { double deltaTime = time2 - time1; switch (state) { case STATE_DCH: case TAIL_DCH: return deltaTime * prof.getPowerDch(); case STATE_FACH: case TAIL_FACH: return deltaTime * prof.getPowerFach(); case STATE_IDLE: return deltaTime * prof.getPowerIdle(); case PROMO_IDLE_DCH: return deltaTime * prof.getPowerIdleDch(); case PROMO_FACH_DCH: return deltaTime * prof.getPowerFachDch(); default: assert (true); } return 0.0f; }  @Override Profile create(ProfileType typeParm, Properties prop); @Override double energy3G(double time1, double time2, RRCState state, Profile3G prof); @Override Profile create3Gdefault(); @Override Profile create3GFromDefaultResourceFile(); @Override Profile create3GFromFilePath(String filepath); @Override Profile create3G(InputStream input); @Override Profile create3G(Properties properties); @Override void save3G(String filepath, Profile3G prof); @Override void save3G(OutputStream output, Profile3G prof); @Override double energyLTE(double time1, double time2, RRCState state, ProfileLTE prof, List<PacketInfo> packets); @Override Profile createLTEdefault(); @Override Profile createLTEFromDefaultResourceFile(); @Override Profile createLTEFromFilePath(String filepath); @Override Profile createLTE(InputStream input); @Override Profile createLTE(Properties properties); @Override void saveLTE(String filepath, ProfileLTE prof); @Override void saveLTE(OutputStream output, ProfileLTE prof); @Override double energyWiFi(double time1, double time2, RRCState state , ProfileWiFi prof); @Override Profile createWiFidefault(); @Override Profile createWiFiFromFilePath(String filepath); @Override Profile createWiFiFromDefaultResourceFile(); @Override Profile createWiFi(InputStream input); @Override Profile createWiFi(Properties properties); @Override void saveWiFi(String filepath, ProfileWiFi prof); @Override void saveWiFi(OutputStream output, ProfileWiFi prof);  }