Engine { public static Engine getEngine() { if (singletonEngine == null) { synchronized (Engine.class) { if (singletonEngine == null) { singletonEngine = new Engine(); } } } return singletonEngine; } private  Engine(); static Engine getEngine(); void evaluate(Plan plan);  }
@Test public void testSingleton() { Engine engine2 = Engine.getEngine(); Assert.assertSame(engine2, engine); }