@Test public void givenANameWhenTheNotificationChannelIsRequestedThenTheChannelIsReturned() throws Exception { EmailNotificationChannel email = mock(EmailNotificationChannel.class); FaxNotificationChannel fax = mock(FaxNotificationChannel.class); NotificationChannelFactory notificationChannelFactory = new NotificationChannelFactory(email, fax); Assert.assertEquals(email, notificationChannelFactory.getNotificationChannel(NotificationType.EMAIL)); Assert.assertEquals(fax, notificationChannelFactory.getNotificationChannel(NotificationType.FAX)); }
public NotificationChannel getNotificationChannel(NotificationType type) { return notificationChannels.get(type); }
NotificationChannelFactory { public NotificationChannel getNotificationChannel(NotificationType type) { return notificationChannels.get(type); } }
NotificationChannelFactory { public NotificationChannel getNotificationChannel(NotificationType type) { return notificationChannels.get(type); } @Autowired  NotificationChannelFactory(EmailNotificationChannel emailNotificationChannel, FaxNotificationChannel faxNotificationChannel); }
NotificationChannelFactory { public NotificationChannel getNotificationChannel(NotificationType type) { return notificationChannels.get(type); } @Autowired  NotificationChannelFactory(EmailNotificationChannel emailNotificationChannel, FaxNotificationChannel faxNotificationChannel); NotificationChannel getNotificationChannel(NotificationType type); }
NotificationChannelFactory { public NotificationChannel getNotificationChannel(NotificationType type) { return notificationChannels.get(type); } @Autowired  NotificationChannelFactory(EmailNotificationChannel emailNotificationChannel, FaxNotificationChannel faxNotificationChannel); NotificationChannel getNotificationChannel(NotificationType type);  }