WillemJiang closed pull request #192: [SCB-584] Clear up testing code for Dubbo filter tests URL: https://github.com/apache/incubator-servicecomb-saga/pull/192
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/omega/omega-transport/omega-transport-dubbo/src/test/java/SagaDubboConsumerFilterTest.java b/omega/omega-transport/omega-transport-dubbo/src/test/java/SagaDubboConsumerFilterTest.java index e601edac..cae2dcec 100644 --- a/omega/omega-transport/omega-transport-dubbo/src/test/java/SagaDubboConsumerFilterTest.java +++ b/omega/omega-transport/omega-transport-dubbo/src/test/java/SagaDubboConsumerFilterTest.java @@ -17,7 +17,6 @@ import com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory; import com.alibaba.dubbo.rpc.Invocation; -import org.apache.servicecomb.saga.omega.context.IdGenerator; import org.apache.servicecomb.saga.omega.context.OmegaContext; import org.apache.servicecomb.saga.omega.transport.dubbo.SagaDubboConsumerFilter; import org.junit.After; @@ -38,8 +37,6 @@ private static final String globalTxId = UUID.randomUUID().toString(); private static final String localTxId = UUID.randomUUID().toString(); - @SuppressWarnings("unchecked") - private final IdGenerator<String> idGenerator = mock(IdGenerator.class); private final OmegaContext omegaContext = new OmegaContext(() -> "ignored"); private final Invocation invocation = mock(Invocation.class); @@ -48,7 +45,7 @@ @Before public void setUp() { - when(idGenerator.nextId()).thenReturn(globalTxId, localTxId); + omegaContext.clear(); when(applicationContext.containsBean("omegaContext")).thenReturn(true); when(applicationContext.getBean("omegaContext")).thenReturn(omegaContext); SpringExtensionFactory.addApplicationContext(applicationContext); diff --git a/omega/omega-transport/omega-transport-dubbo/src/test/java/SagaDubboProviderFilterTest.java b/omega/omega-transport/omega-transport-dubbo/src/test/java/SagaDubboProviderFilterTest.java index 0a5f576a..1b953390 100644 --- a/omega/omega-transport/omega-transport-dubbo/src/test/java/SagaDubboProviderFilterTest.java +++ b/omega/omega-transport/omega-transport-dubbo/src/test/java/SagaDubboProviderFilterTest.java @@ -45,7 +45,6 @@ @Before public void setUp() { omegaContext.clear(); - ApplicationContext applicationContext = mock(ApplicationContext.class); when(applicationContext.containsBean("omegaContext")).thenReturn(true); when(applicationContext.getBean("omegaContext")).thenReturn(omegaContext); SpringExtensionFactory.addApplicationContext(applicationContext); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services