Skip to content

Commit

Permalink
添加UT DUBBO-519 ExtensionLoader的getExtension方法在没有扩展时抛出异常,而不是返回null
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed Jul 27, 2012
1 parent 33dad08 commit 6ab82bf
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public void test_getExtension_WithWrapper() throws Exception {
public void test_getExtension_ExceptionNoExtension() throws Exception {
try {
ExtensionLoader.getExtensionLoader(Ext1.class).getExtension("XXX");
fail();
} catch (IllegalStateException expected) {
assertThat(expected.getMessage(), containsString("No such extension com.alibaba.dubbo.common.extensionloader.ext1.Ext1 by name XXX"));
}
Expand All @@ -127,6 +128,7 @@ public void test_getExtension_ExceptionNoExtension() throws Exception {
public void test_getExtension_ExceptionNoExtension_NameOnWrapperNoAffact() throws Exception {
try {
ExtensionLoader.getExtensionLoader(Ext5NoAdaptiveMethod.class).getExtension("XXX");
fail();
} catch (IllegalStateException expected) {
assertThat(expected.getMessage(), containsString("No such extension com.alibaba.dubbo.common.extensionloader.ext5.Ext5NoAdaptiveMethod by name XXX"));
}
Expand All @@ -136,6 +138,7 @@ public void test_getExtension_ExceptionNoExtension_NameOnWrapperNoAffact() throw
public void test_getExtension_ExceptionNullArg() throws Exception {
try {
ExtensionLoader.getExtensionLoader(Ext1.class).getExtension(null);
fail();
} catch (IllegalArgumentException expected) {
assertThat(expected.getMessage(), containsString("Extension name == null"));
}
Expand Down

0 comments on commit 6ab82bf

Please sign in to comment.