@Test(expected = RuntimeException.class) public void testGetInstances_Fail() throws Exception { config.put(DefaultJerseyOptions.CONFIG_INSTANCES, new JsonArray().add(MyObj.class.getName() + ".invalid")); options.getInstances(); fail(); }
@Test public void testGetInstances() throws Exception { config.put(DefaultJerseyOptions.CONFIG_INSTANCES, new JsonArray().add(MyObj.class.getName())); config.put(DefaultJerseyOptions.CONFIG_BINDERS, new JsonArray().add(MyBinder.class.getName())); Set<Object> instances = options.getInstances(); assertNotNull(instances); assertEquals(2, instances.size()); List<Object> list = new ArrayList<>(instances); assertThat(list.get(0), instanceOf(MyObj.class)); assertThat(list.get(1), instanceOf(MyBinder.class)); }