Search in sources :

Example 1 with TestPojoConsumerProvider

use of org.apache.servicecomb.provider.pojo.TestPojoConsumerProvider in project incubator-servicecomb-java-chassis by apache.

the class MockUtil method mockMicroserviceMeta.

public void mockMicroserviceMeta() {
    new MockUp<MicroserviceMeta>() {

        @Mock
        public SchemaMeta ensureFindSchemaMeta(String schemaId) {
            SchemaMeta lSchemaMeta = Mockito.mock(SchemaMeta.class);
            Mockito.when(lSchemaMeta.getSwaggerIntf()).thenAnswer(new Answer<Class<? extends TestPojoConsumerProvider>>() {

                @Override
                public Class<? extends TestPojoConsumerProvider> answer(InvocationOnMock invocation) throws Throwable {
                    return TestPojoConsumerProvider.class;
                }
            });
            return lSchemaMeta;
        }

        @Mock
        public SchemaMeta ensureFindSchemaMeta(Class<?> schemaIntf) {
            return Mockito.mock(SchemaMeta.class);
        }
    };
}
Also used : InvocationOnMock(org.mockito.invocation.InvocationOnMock) SchemaMeta(org.apache.servicecomb.core.definition.SchemaMeta) MockUp(mockit.MockUp) TestPojoConsumerProvider(org.apache.servicecomb.provider.pojo.TestPojoConsumerProvider)

Aggregations

MockUp (mockit.MockUp)1 SchemaMeta (org.apache.servicecomb.core.definition.SchemaMeta)1 TestPojoConsumerProvider (org.apache.servicecomb.provider.pojo.TestPojoConsumerProvider)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1