### Question:
NotificationChannelFactory { public NotificationChannel getNotificationChannel(NotificationType type) { return notificationChannels.get(type); } @Autowired  NotificationChannelFactory(EmailNotificationChannel emailNotificationChannel, FaxNotificationChannel faxNotificationChannel); NotificationChannel getNotificationChannel(NotificationType type);  }### Answer:
@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)); }