### Question:
WebRadioMessageFactory extends AbstractMessageFactory { @Override public List<Message2Send> getMessage(MessageProcessUnit inUnit) { if (inUnit instanceof MessageNSettingProcessUnit) { final SubscriptionSchedulingData theSubscriptionSchedulingData = inUnit.get(); final ApplicationSettingData urlSetting = ApplicationSettingData.findByApplicationAndKey(theSubscriptionSchedulingData.getSubscription().getApplication(), WebRadioMessageFactory.URL); if ((urlSetting == null) || !urlSetting.isValid()) { WebRadioMessageFactory.LOGGER.fatal("This webradio does not have any url : " + theSubscriptionSchedulingData.getSubscription().getApplication().getName()); } else { final VObject theObject = theSubscriptionSchedulingData.getSubscription().getObject().getReference(); final SubscriptionSchedulingSettingsData theSetting = ((MessageNSettingProcessUnit) inUnit).getSchedulingSettingsData(); final int listeningTime = Integer.parseInt(SubscriptionSchedulingSettingsData.findBySubscriptionSchedulingAndKey(theSubscriptionSchedulingData, theSetting.getKey() + DailyWithDurationHandler.DURATION_SUFFIXE).getValue()); return WebRadioMessageFactory.getMessage2Send(urlSetting.getValue(), theObject, inUnit.getProcessConditioner(), listeningTime, System.currentTimeMillis()); } } return Collections.emptyList(); }  @Override List<Message2Send> getMessage(MessageProcessUnit inUnit); static List<Message2Send> getMessage2Send(final String inUrl, VObject inVObject, CCalendar inDeliveryDate, int inListeningTime, long nowTimeStamp); static void sendMessage(String inURL, VObject inObject, CCalendar inDeliveryDate); static final String URL; }### Answer:
@Test public void testMessageNull() { final AbstractMessageFactory theWrFactory = AbstractMessageFactory.getFactoryByApplication(Factories.APPLICATION.findByName("net.violet.webradio.U105")); Assert.assertTrue(theWrFactory.getMessage(null).isEmpty()); }
@Test public void testMessageNSettingProcessUnit() { final Application theApplication = Factories.APPLICATION.findByName("net.violet.webradio.U105"); Factories.APPLICATION_SETTING.create(theApplication, "url", "webradioUrl"); final Subscription theSubscription = new SubscriptionMock(1, theApplication, getKowalskyObject()); final CCalendar theDeliveryDate = new CCalendar(false); theDeliveryDate.addMillis(3600000L); final SubscriptionData theSubscriptionData = SubscriptionData.getData(theSubscription); final SubscriptionSchedulingData theScheduling = SubscriptionSchedulingData.create(theSubscriptionData, SchedulingType.SCHEDULING_TYPE.DailyWithDuration); theScheduling.createSetting(DailyHandler.Weekday.THURSDAY.getValue(), "10:30:00"); final SubscriptionSchedulingSettingsData theSchedulingSetting = theScheduling.createSetting(DailyHandler.Weekday.THURSDAY.getValue(), "10:30:00"); theScheduling.createSetting(DailyHandler.Weekday.THURSDAY.getValue() + DailyWithDurationHandler.DURATION_SUFFIXE, "113233313"); final MessageNSettingProcessUnit theMessage = new MessageNSettingProcessUnit(theSchedulingSetting, theScheduling, null, null) { @Override public void runWhenSuccessful() { } }; final AbstractMessageFactory theWrFactory = AbstractMessageFactory.getFactoryByApplication(Factories.APPLICATION.findByName("net.violet.webradio.U105")); Assert.assertEquals(2, theWrFactory.getMessage(theMessage).size()); }