@Test
    public void testAll() throws Exception {
        String old = RpcConfigs.getStringValue(RpcOptions.MODULE_LOAD_LIST);
        try {
            RpcConfigs.putValue(RpcOptions.MODULE_LOAD_LIST, "*,-test3");

            ModuleFactory.installModules();
            Assert.assertFalse(ModuleFactory.INSTALLED_MODULES.isEmpty());
            Assert.assertTrue(ModuleFactory.INSTALLED_MODULES.containsKey("test"));
            Assert.assertTrue(ModuleFactory.INSTALLED_MODULES.containsKey("test2"));
            Assert.assertFalse(ModuleFactory.INSTALLED_MODULES.containsKey("testNot"));
            Assert.assertEquals("testi", TestModules.test);
            Assert.assertEquals("test2i", TestModules.test2);
            Assert.assertNull(TestModules.testNot);

            TestModules.error = true;
            ModuleFactory.uninstallModule("test");
            Assert.assertTrue(ModuleFactory.INSTALLED_MODULES.containsKey("test"));
            TestModules.error = false;

            TestModules.error = false;
            ModuleFactory.uninstallModule("test");
            Assert.assertFalse(ModuleFactory.INSTALLED_MODULES.containsKey("test"));
            Assert.assertTrue(ModuleFactory.INSTALLED_MODULES.containsKey("test2"));
            Assert.assertEquals("testu", TestModules.test);
            Assert.assertEquals("test2i", TestModules.test2);
            Assert.assertNull(TestModules.testNot);

            TestModules.error = true;
            ModuleFactory.uninstallModules();
            Assert.assertTrue(ModuleFactory.INSTALLED_MODULES.containsKey("test2"));
            TestModules.error = false;

            ModuleFactory.uninstallModules();
            Assert.assertTrue(ModuleFactory.INSTALLED_MODULES.isEmpty());
            Assert.assertEquals("testu", TestModules.test);
            Assert.assertEquals("test2u", TestModules.test2);
            Assert.assertNull(TestModules.testNot);
        } finally {
            if (old != null) {
                RpcConfigs.putValue(RpcOptions.MODULE_LOAD_LIST, old);
            }
        }
    }
@author <a href="mailto:zhanggeng.zg@antfin.com">GengZhang</a>
core/api/src/test/java/com/alipay/sofa/rpc/module/ModuleFactoryTest.java