InstanceFactory implements Factory<T> { public static <T> Factory<T> create(T instance) { if (instance == null) { throw new NullPointerException(); } return new InstanceFactory<T>(instance); } private  InstanceFactory(T instance); static Factory<T> create(T instance); @Override T get();  }
@Test public void create_throwsNullPointerException() { thrown.expect(NullPointerException.class); InstanceFactory.create(null); }