ConfigurableUtil { public static <T> T createConfigurable( Class<T> clazz, Dictionary<?, ?> properties) { return _createConfigurableSnapshot( clazz, Configurable.createConfigurable(clazz, properties)); }  static T createConfigurable(
		Class<T> clazz, Dictionary<?, ?> properties); static T createConfigurable(
		Class<T> clazz, Map<?, ?> properties);  }
@AdviseWith(adviceClasses = ConfigurableUtilAdvice.class) @NewEnv(type = NewEnv.Type.CLASSLOADER) @Test public void testConcurrentCreateConfigurable() throws Exception { Callable<TestConfiguration> callable = () -> ConfigurableUtil.createConfigurable( TestConfiguration.class, Collections.singletonMap( "testReqiredString", "testReqiredString")); FutureTask<TestConfiguration> futureTask1 = new FutureTask<>(callable); FutureTask<TestConfiguration> futureTask2 = new FutureTask<>(callable); Thread thread1 = new Thread( futureTask1, "Configurable Util Test Thread 1"); Thread thread2 = new Thread( futureTask2, "Configurable Util Test Thread 2"); thread1.start(); thread2.start(); ConfigurableUtilAdvice.waitUntilBlock(); ConfigurableUtilAdvice.unblock(); _assertTestConfiguration(futureTask1.get(), "testReqiredString"); _assertTestConfiguration(futureTask2.get(), "testReqiredString"); }
@Test public void testCreateConfigurable() { Dictionary<String, String> dictionary = new HashMapDictionary<>(); dictionary.put("testReqiredString", "testReqiredString1"); _assertTestConfiguration( ConfigurableUtil.createConfigurable( TestConfiguration.class, dictionary), "testReqiredString1"); _assertTestConfiguration( ConfigurableUtil.createConfigurable( TestConfiguration.class, Collections.singletonMap( "testReqiredString", "testReqiredString2")), "testReqiredString2"); }
@Test public void testMisc() { try { ConfigurableUtil.createConfigurable( TestConfiguration.class, Collections.emptyMap()); Assert.fail(); } catch (RuntimeException runtimeException) { Assert.assertEquals( "Unable to create snapshot class for " + TestConfiguration.class, runtimeException.getMessage()); Throwable throwable = runtimeException.getCause(); throwable = throwable.getCause(); Assert.assertTrue(throwable instanceof IllegalStateException); Assert.assertEquals( "Attribute is required but not set testReqiredString", throwable.getMessage()); } new ConfigurableUtil(); }