### Question:
BundleModel { public String getState() { return BundleStates.from(bundle); } BundleModel(Bundle bundle); static List<BundleModel> bundles(BundleContext context); String getState(); long getId(); String getName(); Map<String, String> getHeaders();  }### Answer:
@Test public void state() throws Exception { Bundle bundle = mock(Bundle.class); BundleModel model = new BundleModel(bundle); when(bundle.getState()).thenReturn(Bundle.ACTIVE); assertThat(model.getState()).isEqualTo("ACTIVE"); when(bundle.getState()).thenReturn(Bundle.INSTALLED); assertThat(model.getState()).isEqualTo("INSTALLED"); when(bundle.getState()).thenReturn(Bundle.RESOLVED); assertThat(model.getState()).isEqualTo("RESOLVED"); }