diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java index 8435db5d41a..c02a222afe4 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java @@ -820,6 +820,16 @@ public void setGeneric(String generic) { } } + @Override + public void setMock(Boolean mock) { + throw new IllegalArgumentException("mock doesn't support on provider side"); + } + + @Override + public void setMock(String mock) { + throw new IllegalArgumentException("mock doesn't support on provider side"); + } + public List getExportedUrls() { return urls; } diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ServiceConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ServiceConfigTest.java index ed5a2e33d7f..2765b9fa18d 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ServiceConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ServiceConfigTest.java @@ -194,6 +194,18 @@ public void testGeneric2() throws Exception { service.setGeneric("illegal"); } + @Test(expected = IllegalArgumentException.class) + public void testMock() throws Exception { + ServiceConfig service = new ServiceConfig(); + service.setMock("true"); + } + + @Test(expected = IllegalArgumentException.class) + public void testMock2() throws Exception { + ServiceConfig service = new ServiceConfig(); + service.setMock(true); + } + @Test public void testUniqueServiceName() throws Exception { ServiceConfig service = new ServiceConfig();