### Question:
ServiceOperations { public static void init(Service service, Configuration configuration) { Service.STATE state = service.getServiceState(); ensureCurrentState(state, Service.STATE.NOTINITED); service.init(configuration); } private  ServiceOperations(); static void ensureCurrentState(Service.STATE state,
                                        Service.STATE expectedState); static void init(Service service, Configuration configuration); static void start(Service service); static void deploy(Service service, Configuration configuration); static void stop(Service service); static Exception stopQuietly(Service service);  }### Answer:
@Test public void testInitTwice() throws Throwable { BreakableService svc = new BreakableService(); Configuration conf = new Configuration(); conf.set("test.init", "t"); ServiceOperations.init(svc, conf); try { ServiceOperations.init(svc, new Configuration()); fail("Expected a failure, got " + svc); } catch (IllegalStateException e) { } assertStateCount(svc, Service.STATE.INITED, 1); assertServiceConfigurationContains(svc, "test.init"); }