@Test public void testBundles() throws Exception { final Bundle bundle1 = mock(Bundle.class); when(bundle1.getBundleId()).thenReturn(1l); final Bundle bundle2 = mock(Bundle.class); when(bundle2.getBundleId()).thenReturn(2l); BundleContext bc = mock(BundleContext.class); when(bc.getBundles()).thenReturn(new Bundle[] { bundle1, bundle2 }); assertThat(BundleModel.bundles(bc)) .have(new Condition<BundleModel>() { @Override public boolean matches(BundleModel model) { return model.getId() == bundle1.getBundleId() || model.getId() == bundle2.getBundleId(); } }) .hasSize(2); }
public static List<BundleModel> bundles(BundleContext context) { List<BundleModel> bundles = new ArrayList<>(); for (Bundle bundle : context.getBundles()) { bundles.add(new BundleModel(bundle)); } return bundles; }
BundleModel { public static List<BundleModel> bundles(BundleContext context) { List<BundleModel> bundles = new ArrayList<>(); for (Bundle bundle : context.getBundles()) { bundles.add(new BundleModel(bundle)); } return bundles; } }
BundleModel { public static List<BundleModel> bundles(BundleContext context) { List<BundleModel> bundles = new ArrayList<>(); for (Bundle bundle : context.getBundles()) { bundles.add(new BundleModel(bundle)); } return bundles; } BundleModel(Bundle bundle); }
BundleModel { public static List<BundleModel> bundles(BundleContext context) { List<BundleModel> bundles = new ArrayList<>(); for (Bundle bundle : context.getBundles()) { bundles.add(new BundleModel(bundle)); } return bundles; } BundleModel(Bundle bundle); static List<BundleModel> bundles(BundleContext context); String getState(); long getId(); String getName(); Map<String, String> getHeaders(); }
BundleModel { public static List<BundleModel> bundles(BundleContext context) { List<BundleModel> bundles = new ArrayList<>(); for (Bundle bundle : context.getBundles()) { bundles.add(new BundleModel(bundle)); } return bundles; } BundleModel(Bundle bundle); static List<BundleModel> bundles(BundleContext context); String getState(); long getId(); String getName(); Map<String, String> getHeaders();  }