@Test public void testCommandBusIsNotAutowiredWhenProvided() throws Exception { testSubject.afterPropertiesSet(); verify(mockApplicationContext, never()).getBeansOfType(CommandBus.class); }
@Test public void testCommandBusIsAutowired() throws Exception { testSubject.setCommandBus(null); Map<String, CommandBus> map = new HashMap<String, CommandBus>(); map.put("ignored", mockCommandBus); when(mockApplicationContext.getBeansOfType(CommandBus.class)).thenReturn(map); testSubject.afterPropertiesSet(); verify(mockApplicationContext).getBeansOfType(CommandBus.class); }