### Question:
FactoryModel { public String getHandlerName() { if (factory instanceof HandlerFactory) { return ((HandlerFactory) factory).getHandlerName(); } return null; } protected  FactoryModel(Factory factory); static List<FactoryModel> factories(BundleContext context); String getName(); boolean isHandler(); String getArchitecture(); String getHandlerName(); String getState();  }### Answer:
@Test public void testGetHandlerName() throws Exception { Factory factory = mock(Factory.class); when(factory.getName()).thenReturn("foo"); FactoryModel model = new FactoryModel(factory); assertThat(model.getHandlerName()).isNull(); HandlerFactory hf = mock(HandlerFactory.class); when(hf.getName()).thenReturn("foo"); when(hf.getHandlerName()).thenReturn("foo:foo"); model = new FactoryModel(hf); assertThat(model.getHandlerName()).isEqualTo("foo:foo"); }