Skip to content

Commit

Permalink
Merge pull request #42 from JoeKerouac/1.6.1.20180301
Browse files Browse the repository at this point in the history
更改测试用例
  • Loading branch information
JoeKerouac committed Apr 1, 2018
2 parents 4fc8302 + 611c1a4 commit e1d7459
Showing 1 changed file with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ public void shouldLoadModule() {
removeModule(module);
}

private void removeModule(Module module) {moduleManager.remove(module.getName());}
private void removeModule(Module module) {
moduleManager.remove(module.getName());
}

@Test
public void shouldRegisterModule() throws MalformedURLException {
Expand All @@ -92,6 +94,23 @@ public void shouldRegisterModule() throws MalformedURLException {
removeModule(module);
}

@Test
public void shouldDoOverrideAction() {
//测试注解action被xml中的action覆盖
ModuleConfig config = buildModuleConfig(true);
config.addScanPackage("com.alipay.jarslink.main");
config.addScanPackage("com.alipay.jarslink.demo");

Module module = moduleLoader.load(config);
Action<String, String> action = null;
try {
action = module.getAction("overrideXmlAction");
} catch (Exception e) {
Assert.assertNotNull(e);
}
Assert.assertNull(action);
}

@Test
public void shouldDoAnnotationAction() {
//annotation方式加载,测试annotation中注入xml定义的action 同时测试annotation action和xmlaction同时加载
Expand Down Expand Up @@ -126,17 +145,6 @@ public void shouldDoAnnotationAction() {
result = action.execute("hello");
Assert.assertNotNull(result);
Assert.assertEquals(result, "xml:hello");

//测试xml中和annotation注册同名bean(不能同时存在,如果有重名的情况下以xml中的为主)
//4.2:查找和执行Action
action = null;
try {
action = module.getAction("overrideXmlAction");
} catch (Exception e) {
Assert.assertNotNull(e);
}
Assert.assertNull(action);
removeModule(module);
}

@Test
Expand Down

0 comments on commit e1d7459

Please sign in to comment.