Search in sources :

Example 1 with MockBaseClient

use of com.microsoft.graph.core.MockBaseClient in project msgraph-sdk-java by microsoftgraph.

the class BaseCollectionPageTests method setUp.

@Before
public void setUp() throws Exception {
    list = new ArrayList<String>();
    list.add("Object1");
    list.add("Object2");
    list.add("Object3");
    IBaseClient mBaseClient = new MockBaseClient();
    mRequestBuilder = new MockRequestBuilder(mBaseClient, requestUrl);
    baseCollectionPage = new BaseCollectionPage<String, IRequestBuilder>(list, mRequestBuilder) {
    };
}
Also used : MockBaseClient(com.microsoft.graph.core.MockBaseClient) IBaseClient(com.microsoft.graph.core.IBaseClient) Before(org.junit.Before)

Example 2 with MockBaseClient

use of com.microsoft.graph.core.MockBaseClient in project msgraph-sdk-java by microsoftgraph.

the class BaseRequestTests method setUp.

@Before
public void setUp() throws Exception {
    mAuthenticationProvider = new MockAuthenticationProvider();
    mBaseClient = new MockBaseClient();
    final ITestConnectionData data = new ITestConnectionData() {

        @Override
        public int getRequestCode() {
            return 200;
        }

        @Override
        public String getJsonResponse() {
            return "{ \"id\": \"zzz\" }";
        }

        @Override
        public Map<String, String> getHeaders() {
            final HashMap<String, String> map = new HashMap<>();
            map.put("Content-Type", "application/json");
            return map;
        }
    };
    MockHttpProvider mProvider = new MockHttpProvider(new MockSerializer(null, ""), mAuthenticationProvider, new MockExecutors(), new MockLogger());
    mProvider.setConnectionFactory(new MockConnectionFactory(new MockConnection(data)));
    mBaseClient.setHttpProvider(mProvider);
    request = new BaseRequest("https://a.b.c", mBaseClient, null, null) {
    };
}
Also used : MockSerializer(com.microsoft.graph.serializer.MockSerializer) HashMap(java.util.HashMap) MockBaseClient(com.microsoft.graph.core.MockBaseClient) MockExecutors(com.microsoft.graph.concurrency.MockExecutors) MockLogger(com.microsoft.graph.logger.MockLogger) MockAuthenticationProvider(com.microsoft.graph.authentication.MockAuthenticationProvider) Before(org.junit.Before)

Example 3 with MockBaseClient

use of com.microsoft.graph.core.MockBaseClient in project msgraph-sdk-java by microsoftgraph.

the class BaseStreamRequestTests method setUp.

@Before
public void setUp() throws Exception {
    mAuthenticationProvider = new MockAuthenticationProvider();
    mBaseClient = new MockBaseClient();
}
Also used : MockAuthenticationProvider(com.microsoft.graph.authentication.MockAuthenticationProvider) MockBaseClient(com.microsoft.graph.core.MockBaseClient) Before(org.junit.Before)

Example 4 with MockBaseClient

use of com.microsoft.graph.core.MockBaseClient in project msgraph-sdk-java by microsoftgraph.

the class BaseCollectionRequestTests method setUp.

@Before
public void setUp() throws Exception {
    mAuthenticationProvider = new MockAuthenticationProvider();
    mBaseClient = new MockBaseClient();
    final ITestConnectionData data = new ITestConnectionData() {

        @Override
        public int getRequestCode() {
            return 200;
        }

        @Override
        public String getJsonResponse() {
            return "{ \"id\": \"zzz\" }";
        }

        @Override
        public Map<String, String> getHeaders() {
            final HashMap<String, String> map = new HashMap<>();
            map.put("Content-Type", "application/json");
            return map;
        }
    };
    MockHttpProvider mProvider = new MockHttpProvider(new MockSerializer(null, ""), mAuthenticationProvider, new MockExecutors(), new MockLogger());
    mProvider.setConnectionFactory(new MockConnectionFactory(new MockConnection(data)));
    mBaseClient.setHttpProvider(mProvider);
    request = new BaseCollectionRequest<JsonObject, String>("https://a.b.c", mBaseClient, null, JsonObject.class, null) {
    };
}
Also used : MockSerializer(com.microsoft.graph.serializer.MockSerializer) HashMap(java.util.HashMap) MockBaseClient(com.microsoft.graph.core.MockBaseClient) MockExecutors(com.microsoft.graph.concurrency.MockExecutors) JsonObject(com.google.gson.JsonObject) MockLogger(com.microsoft.graph.logger.MockLogger) MockAuthenticationProvider(com.microsoft.graph.authentication.MockAuthenticationProvider) Before(org.junit.Before)

Aggregations

MockBaseClient (com.microsoft.graph.core.MockBaseClient)4 Before (org.junit.Before)4 MockAuthenticationProvider (com.microsoft.graph.authentication.MockAuthenticationProvider)3 MockExecutors (com.microsoft.graph.concurrency.MockExecutors)2 MockLogger (com.microsoft.graph.logger.MockLogger)2 MockSerializer (com.microsoft.graph.serializer.MockSerializer)2 HashMap (java.util.HashMap)2 JsonObject (com.google.gson.JsonObject)1 IBaseClient (com.microsoft.graph.core.IBaseClient)1