### Question:
InstanceModel { public InstanceModel(Architecture architecture) { this.architecture = architecture; } InstanceModel(Architecture architecture); static List<InstanceModel> instances(BundleContext context); String getName(); String getArchitecture(); String getFactory(); String getState(); List<ProvidedServiceModel> getServices(); List<ServiceDependencyModel> getDependencies();  }### Answer:
@Test public void testInstanceModel() { InstanceDescription description = mock(InstanceDescription.class); when(description.getName()).thenReturn("my-instance"); when(description.getDescription()).thenReturn(new Element("instance", null)); when(description.getState()).thenReturn(ComponentInstance.VALID); Architecture arch = mock(Architecture.class); when(arch.getInstanceDescription()).thenReturn(description); InstanceModel model = new InstanceModel(arch); assertThat(model.getName()).isEqualTo("my-instance"); assertThat(model.getState()).isEqualTo("VALID"); assertThat(model.getArchitecture()).contains("instance"); when(description.getState()).thenReturn(ComponentInstance.INVALID); assertThat(model.getState()).isEqualTo("INVALID"); when(description.getState()).thenReturn(ComponentInstance.STOPPED); assertThat(model.getState()).isEqualTo("STOPPED"); when(description.getState()).thenReturn(28); assertThat(model.getState()).isEqualTo("UNKNOWN"); }