Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leadVisionary/3644876 to your computer and use it in GitHub Desktop.
Save leadVisionary/3644876 to your computer and use it in GitHub Desktop.
Not like this
@Test
public void testConfiguration_shouldHaveWrittenTheLaterOne() throws Exception {
ServiceReference[] allServiceReferences = ctx.getAllServiceReferences(ConfigurationAdmin.class.getName(), null);
for (ServiceReference serviceReference : allServiceReferences) {
ConfigurationAdmin service = (ConfigurationAdmin) ctx.getService(serviceReference);
try {
org.osgi.service.cm.Configuration configuration = service.getConfiguration("tests");
assertEquals("myvalue2", configuration.getProperties().get("mykey"));
return;
} catch (Exception e) {
// continue
}
}
fail();
}
@leadVisionary
Copy link
Author

I like it when the code is both functional and self-critiquing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment