### Question:
SizeOfEngineLoader implements SizeOfEngineFactory { @Override public SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent) { SizeOfEngineFactory currentFactory = this.factory; if (currentFactory != null) { return currentFactory.createSizeOfEngine(maxObjectCount, abort, silent); } return new DefaultSizeOfEngine(maxObjectCount, abort, silent); } SizeOfEngineLoader(ClassLoader classLoader); private  SizeOfEngineLoader(); static SizeOfEngine newSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent); @Override SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent); void reload(); synchronized boolean load(Class<? extends SizeOfEngineFactory> clazz, boolean reload); static final SizeOfEngineLoader INSTANCE; }### Answer:
@Test public void testFallsBackToDefaultSizeOfEngine() { final SizeOfEngine sizeOfEngine = SizeOfEngineLoader.INSTANCE.createSizeOfEngine(10, true, true); assertThat(sizeOfEngine, notNullValue()); assertThat(sizeOfEngine, instanceOf(DefaultSizeOfEngine.class)); }
@Test public void testUsesServiceLoaderWhenItCan() { ClassLoader cl = new CheatingClassLoader(); SizeOfEngineLoader loader = new SizeOfEngineLoader(cl); assertThat(loader.createSizeOfEngine(10, true, true), sameInstance(constantSizeOfEngine)); }