ProvisioningService implements ProvisioningServiceMBean { public void addInformation(TabularData info) throws IOException { Dictionary<String, Object> provisioningInfo = extractProvisioningDictionary(info); provisioningService.addInformation(provisioningInfo); } ProvisioningService(org.osgi.service.provisioning.ProvisioningService provisioningService); void addInformationFromZip(String zipURL); void addInformation(TabularData info); @SuppressWarnings("unchecked") TabularData listInformation(); void setInformation(TabularData info);  }
@Test @SuppressWarnings("unchecked") public void testAddInformationWithTabularData() throws Exception { org.osgi.service.provisioning.ProvisioningService provService = mock(org.osgi.service.provisioning.ProvisioningService.class); ProvisioningService mbean = new ProvisioningService(provService); TabularData data = new TabularDataSupport(PROPERTIES_TYPE); PropertyData<byte[]> p1 = PropertyData.newInstance(PROVISIONING_AGENT_CONFIG, new byte[] { 20, 30, 40 }); data.put(p1.toCompositeData()); PropertyData<String> p2 = PropertyData.newInstance(PROVISIONING_SPID, "x.test"); data.put(p2.toCompositeData()); mbean.addInformation(data); ArgumentCaptor<Dictionary> dictionaryArgument = ArgumentCaptor.forClass(Dictionary.class); verify(provService).addInformation(dictionaryArgument.capture()); Dictionary<String, Object> info = dictionaryArgument.getValue(); assertEquals(2, info.size() ); assertArrayEquals(new byte[] { 20, 30, 40 }, (byte[]) info.get(PROVISIONING_AGENT_CONFIG)); assertEquals("x.test", info.get(PROVISIONING_SPID)); }