@@ -0,0 +1,2091 @@
+package com.mymoviematch.simpleserver.core;%0A%0A%0Aimport com.mymoviematch.simpleserver.conf.Configuration;%0Aimport com.mymoviematch.simpleserver.module.ServerModule;%0Aimport org.junit.Test;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.Matchers.is;%0A%0A%0Apublic class ServerTest %7B%0A%0A    @Test%0A    public void testWorkflow() %7B%0A        Server server = new Server();%0A%0A        ServerModuleTest module1 = new ServerModuleTest();%0A        List%3CServerModuleTest%3E modules = new ArrayList%3CServerModuleTest%3E() %7B%7B%0A            new ServerModuleTest();%0A            new ServerModuleTest();%0A        %7D%7D;%0A%0A        server.addModule(module1);%0A        server.addModules(modules);%0A%0A        server.shutdown();%0A%0A        server.run();%0A%0A        assertThat(module1.wasInited, is(true));%0A        assertThat(module1.wasStarted, is(true));%0A        assertThat(module1.wasStopped, is(true));%0A%0A        modules.forEach(m -%3E %7B%0A            assertThat(m.wasInited, is(true));%0A            assertThat(m.wasInited, is(true));%0A            assertThat(m.wasStopped, is(true));%0A        %7D);%0A    %7D%0A%0A%0A    @Test(expected = ServerException.class)%0A    public void addModule() %7B%0A        Server server = new Server();%0A%0A        server.shutdown();%0A%0A        server.run();%0A%0A        server.addModule(new ServerModuleTest());%0A    %7D%0A%0A%0A    @Test(expected = ServerException.class)%0A    public void addModules() %7B%0A        Server server = new Server();%0A%0A        server.shutdown();%0A%0A        server.run();%0A%0A        server.addModules(new ArrayList%3CServerModuleTest%3E() %7B%7B new ServerModuleTest(); %7D%7D);%0A    %7D%0A%0A%0A    private class ServerModuleTest implements ServerModule %7B%0A%0A        boolean wasInited = false;%0A%0A        boolean wasStarted = false;%0A%0A        boolean wasStopped = false;%0A%0A        @Override%0A        public void init(Configuration configuration) %7B%0A            wasInited = true;%0A        %7D%0A%0A%0A        @Override%0A        public void start() %7B%0A            wasStarted = true;%0A        %7D%0A%0A%0A        @Override%0A        public void stop() %7B%0A            wasStopped = true;%0A        %7D%0A    %7D%0A%7D%0A

Implement ServerTest