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