Search in sources :

Example 1 with WXSDKManager

use of com.taobao.weex.WXSDKManager in project weex-example by KalicyZhou.

the class DefaultUriAdapterTest method setup.

@Before
public void setup() {
    WXEnvironment.sApplication = RuntimeEnvironment.application;
    WXSDKManager wxsdkManager = WXSDKManager.getInstance();
    if (!new MockUtil().isSpy(wxsdkManager)) {
        WXSDKManager spy = Mockito.spy(wxsdkManager);
        WXSDKManagerTest.setInstance(spy);
        Mockito.when(spy.getIWXHttpAdapter()).thenReturn(new IWXHttpAdapter() {

            @Override
            public void sendRequest(WXRequest request, OnHttpListener listener) {
            //do nothing.
            }
        });
    }
    adapter = new DefaultUriAdapter();
    instance = WXSDKInstanceTest.createInstance();
}
Also used : MockUtil(org.mockito.internal.util.MockUtil) WXSDKManager(com.taobao.weex.WXSDKManager) WXRequest(com.taobao.weex.common.WXRequest) Before(org.junit.Before)

Example 2 with WXSDKManager

use of com.taobao.weex.WXSDKManager in project incubator-weex by apache.

the class DefaultUriAdapterTest method setup.

@Before
public void setup() {
    WXEnvironment.sApplication = RuntimeEnvironment.application;
    WXSDKManager wxsdkManager = WXSDKManager.getInstance();
    if (!new MockUtil().isSpy(wxsdkManager)) {
        WXSDKManager spy = Mockito.spy(wxsdkManager);
        WXSDKManagerTest.setInstance(spy);
        Mockito.when(spy.getIWXHttpAdapter()).thenReturn(new IWXHttpAdapter() {

            @Override
            public void sendRequest(WXRequest request, OnHttpListener listener) {
            // do nothing.
            }
        });
    }
    adapter = new DefaultUriAdapter();
    instance = WXSDKInstanceTest.createInstance();
}
Also used : MockUtil(org.mockito.internal.util.MockUtil) WXSDKManager(com.taobao.weex.WXSDKManager) WXRequest(com.taobao.weex.common.WXRequest) Before(org.junit.Before)

Aggregations

WXSDKManager (com.taobao.weex.WXSDKManager)2 WXRequest (com.taobao.weex.common.WXRequest)2 Before (org.junit.Before)2 MockUtil (org.mockito.internal.util.MockUtil)2