### Question:
ServiceModel { public String getProvidingBundle() { Bundle bundle = this.reference.getBundle(); StringBuilder builder = new StringBuilder(); String sn = bundle.getSymbolicName(); if (sn != null) { builder.append(sn); builder.append(" [").append(bundle.getBundleId()).append("]"); } else { builder.append("[").append(bundle.getBundleId()).append("]"); } return builder.toString(); } ServiceModel(ServiceReference reference); static List<ServiceModel> services(BundleContext context); String getInterfaces(); long getId(); String getProvidingBundle(); Map<String, String> getProperties();  }### Answer:
@Test public void bundle() throws Exception { Bundle bundle = mock(Bundle.class); when(bundle.getSymbolicName()).thenReturn("acme"); when(bundle.getBundleId()).thenReturn(20l); ServiceReference reference = mock(ServiceReference.class); when(reference.getBundle()).thenReturn(bundle); assertThat(new ServiceModel(reference).getProvidingBundle()).contains("acme").contains("[20]"); when(bundle.getSymbolicName()).thenReturn(null); assertThat(new ServiceModel(reference).getProvidingBundle()).doesNotContain("acme").isEqualTo("[20]"); }