Search in sources :

Example 1 with TestPojoConsumerProvider

use of io.servicecomb.provider.pojo.TestPojoConsumerProvider in project java-chassis by ServiceComb.

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(io.servicecomb.core.definition.SchemaMeta) MockUp(mockit.MockUp) TestPojoConsumerProvider(io.servicecomb.provider.pojo.TestPojoConsumerProvider)

Aggregations

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