ProxyBuilder { public static ProxyBuilder fromContext(FeatureContext context) { Preconditions.throwIllegalArgumentExceptionIfNull(context, "FeatureContext argument is required to create ProxyBuilder."); Preconditions.throwIllegalArgumentExceptionIfNull(context.getConfig().getObserverClass(), "given Configuration object of context doesn't have an oberservClass defined."); try { FeatureObserver observer = context.getConfig().getObserverClass().newInstance(); return new ProxyBuilder(context, observer); } catch (InstantiationException e) { throw new CannotCreateProxyException("unable to create FeatureObserver instance", e); } catch (IllegalAccessException e) { throw new CannotCreateProxyException("unable to create FeatureObserver instance", e); } } private  ProxyBuilder(FeatureContext context, FeatureObserver observer); static ProxyBuilder fromContext(FeatureContext context); T build(T origin); ProxyBuilder withObserver(FeatureObserver observer);  }
@Test(expected=IllegalArgumentException.class) public void fromContext_withoutContext_throwsIllegalArgumentException() { ProxyBuilder.fromContext(null); }
@Test(expected=IllegalArgumentException.class) public void fromContext_withoutObserverClass_throwsIllegalArgumentException() { config.setObserverClass(null); ProxyBuilder.fromContext(context); }
@Test public void fromContext_withContext_returnsNewProxyBuilder() { assertThat(ProxyBuilder.fromContext(context), IsNot.not((ProxyBuilder)null)); }