### Question:
FactoryModel { public String getState() { if (factory.getState() == Factory.INVALID) { return "INVALID"; } else { return "VALID"; } } protected  FactoryModel(Factory factory); static List<FactoryModel> factories(BundleContext context); String getName(); boolean isHandler(); String getArchitecture(); String getHandlerName(); String getState();  }### Answer:
@Test public void testGetState() throws Exception { Factory factory = mock(Factory.class); when(factory.getName()).thenReturn("foo"); when(factory.getState()).thenReturn(Factory.INVALID); FactoryModel model = new FactoryModel(factory); assertThat(model.getState()).contains("INVALID"); when(factory.getState()).thenReturn(Factory.VALID); assertThat(model.getState()).contains("VALID").doesNotContain("INVALID"); }