### Question:
AlarmGroups extends ApiResponse { public static AlarmGroups from(@NonNull final List<Alarm> alarms){ final AlarmGroups alarmGroups = new AlarmGroups(); final ArrayList<Alarm> voiceAlarms = alarmGroups.getVoice(); final ArrayList<Alarm> classicAlarms = alarmGroups.getClassic(); for(final Alarm alarm : alarms){ switch (alarm.getSource()){ case VOICE_SERVICE: voiceAlarms.add(alarm); break; case MOBILE_APP: case OTHER: classicAlarms.add(alarm); break; default: break; } } return alarmGroups; } AlarmGroups(); ArrayList<Alarm> getExpansions(); ArrayList<Alarm> getVoice(); ArrayList<Alarm> getClassic(); int getTotalSize(); static ArrayList<Alarm> getAll(@NonNull final AlarmGroups alarmGroups); static AlarmGroups from(@NonNull final List<Alarm> alarms);  }### Answer:
@Test public void from() throws Exception { final List<Alarm> alarms = new ArrayList<>(3); alarms.add(Alarm.generateVoiceAlarmTestCase()); alarms.add(Alarm.generateExpansionAlarmTestCase()); alarms.add(new Alarm()); final AlarmGroups resultAlarmGroups = AlarmGroups.from(alarms); assertNotNull(resultAlarmGroups); assertEquals(resultAlarmGroups.getClassic().size(), 2); assertEquals(resultAlarmGroups.getVoice().size(), 1); assertEquals(resultAlarmGroups.getExpansions().size(), 0); }