From f87062c7ef663d37fcc74db4fffbec9757355019 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 May 2021 05:16:33 +0000 Subject: [PATCH 01/14] Bump android-actions/setup-android from 2 to 2.0.6 Bumps [android-actions/setup-android](https://github.com/android-actions/setup-android) from 2 to 2.0.6. - [Release notes](https://github.com/android-actions/setup-android/releases) - [Commits](https://github.com/android-actions/setup-android/compare/v2...v2.0.6) Signed-off-by: dependabot[bot] --- .github/workflows/api-level-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/api-level-lint.yml b/.github/workflows/api-level-lint.yml index 5fdc02ebd..cc0ccfc5f 100644 --- a/.github/workflows/api-level-lint.yml +++ b/.github/workflows/api-level-lint.yml @@ -20,7 +20,7 @@ jobs: distribution: 'adopt' java-version: 16 - name: Setup Android SDK - uses: android-actions/setup-android@v2 + uses: android-actions/setup-android@v2.0.6 - name: Add execution right to the script run: chmod +x gradlew working-directory: ./android From c351f95ecb3bf65b51edc23a48466b84899db7ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 May 2021 05:16:39 +0000 Subject: [PATCH 02/14] Bump actions/checkout from 2 to 2.3.4 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 2.3.4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v2.3.4) Signed-off-by: dependabot[bot] --- .github/workflows/api-level-lint.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/sample-build-check.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/api-level-lint.yml b/.github/workflows/api-level-lint.yml index 5fdc02ebd..191d56f91 100644 --- a/.github/workflows/api-level-lint.yml +++ b/.github/workflows/api-level-lint.yml @@ -14,7 +14,7 @@ jobs: lint-api-level: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2.3.4 - uses: actions/setup-java@v2 with: distribution: 'adopt' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7ed1ab092..7d984b319 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 with: # We must fetch at least the immediate parents so that if this is # a pull request then we can checkout the head. diff --git a/.github/workflows/sample-build-check.yml b/.github/workflows/sample-build-check.yml index 960d89731..be4146069 100644 --- a/.github/workflows/sample-build-check.yml +++ b/.github/workflows/sample-build-check.yml @@ -10,7 +10,7 @@ jobs: samples-build-check-device-code: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2.3.4 - uses: actions/setup-java@v2 with: distribution: 'adopt' @@ -24,7 +24,7 @@ jobs: samples-build-check-interactive: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2.3.4 - uses: actions/setup-java@v2 with: distribution: 'adopt' From 73e25f89a92b021590b501671475b76be007099b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 May 2021 05:37:13 +0000 Subject: [PATCH 03/14] Bump mockito-inline from 3.9.0 to 3.10.0 Bumps [mockito-inline](https://github.com/mockito/mockito) from 3.9.0 to 3.10.0. - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v3.9.0...v3.10.0) Signed-off-by: dependabot[bot] --- gradle/dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 23858b144..5769638fd 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -2,7 +2,7 @@ dependencies { // Use JUnit test framework testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.1' - testImplementation 'org.mockito:mockito-inline:3.9.0' + testImplementation 'org.mockito:mockito-inline:3.10.0' api 'com.squareup.okhttp3:okhttp:4.9.1' From f8c1d5a56676afc7dae96281ceb7f615dfedc997 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 May 2021 06:56:28 +0000 Subject: [PATCH 04/14] Bump mockito-inline from 3.9.0 to 3.10.0 Bumps [mockito-inline](https://github.com/mockito/mockito) from 3.9.0 to 3.10.0. - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](https://github.com/mockito/mockito/compare/v3.9.0...v3.10.0) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d0659c0cc..6be15f2b5 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ org.mockito mockito-inline - 3.9.0 + 3.10.0 test From dd831f002fbda5585496620bd53d9d9110de0ed3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 May 2021 06:12:46 +0000 Subject: [PATCH 05/14] Bump junit-jupiter-api from 5.7.1 to 5.7.2 Bumps [junit-jupiter-api](https://github.com/junit-team/junit5) from 5.7.1 to 5.7.2. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.7.1...r5.7.2) Signed-off-by: dependabot[bot] --- gradle/dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 5769638fd..2c915d870 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -1,6 +1,6 @@ dependencies { // Use JUnit test framework - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.1' testImplementation 'org.mockito:mockito-inline:3.10.0' From 9e88bc40a0fb113cf4df7eb9708b7f3808d7bad5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 May 2021 07:40:50 +0000 Subject: [PATCH 06/14] Bump junit-jupiter-engine from 5.7.1 to 5.7.2 Bumps [junit-jupiter-engine](https://github.com/junit-team/junit5) from 5.7.1 to 5.7.2. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.7.1...r5.7.2) Signed-off-by: dependabot[bot] --- gradle/dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 2c915d870..4c0275074 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -1,7 +1,7 @@ dependencies { // Use JUnit test framework testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2' testImplementation 'org.mockito:mockito-inline:3.10.0' api 'com.squareup.okhttp3:okhttp:4.9.1' From 08c5eaac564d9f3359cfe09fbae24acc616aef9a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 May 2021 07:43:53 +0000 Subject: [PATCH 07/14] Bump junit-jupiter-api from 5.7.1 to 5.7.2 Bumps [junit-jupiter-api](https://github.com/junit-team/junit5) from 5.7.1 to 5.7.2. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.7.1...r5.7.2) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6be15f2b5..b6589e4d6 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ org.junit.jupiter junit-jupiter-api - 5.7.1 + 5.7.2 test From b645493ab42343274c7380ecc2c497e0210529aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 May 2021 05:23:53 +0000 Subject: [PATCH 08/14] Bump gson from 2.8.6 to 2.8.7 Bumps [gson](https://github.com/google/gson) from 2.8.6 to 2.8.7. - [Release notes](https://github.com/google/gson/releases) - [Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md) - [Commits](https://github.com/google/gson/compare/gson-parent-2.8.6...gson-parent-2.8.7) Signed-off-by: dependabot[bot] --- gradle/dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 4c0275074..fac6a9c11 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -8,6 +8,6 @@ dependencies { implementation 'com.google.guava:guava:30.1.1-jre' - implementation 'com.google.code.gson:gson:2.8.6' + implementation 'com.google.code.gson:gson:2.8.7' api 'com.azure:azure-core:1.16.0' } \ No newline at end of file From bde72da63196e2834247a1b80d70c98e369420cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 May 2021 06:41:36 +0000 Subject: [PATCH 09/14] Bump gson from 2.8.6 to 2.8.7 Bumps [gson](https://github.com/google/gson) from 2.8.6 to 2.8.7. - [Release notes](https://github.com/google/gson/releases) - [Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md) - [Commits](https://github.com/google/gson/compare/gson-parent-2.8.6...gson-parent-2.8.7) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b6589e4d6..7984c278d 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ com.google.code.gson gson - 2.8.6 + 2.8.7 com.google.guava From ea528a4a3ebacf88421230623a392229e1947a42 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 May 2021 05:21:32 +0000 Subject: [PATCH 10/14] Bump android-actions/setup-android from 2.0.6 to 2.0.7 Bumps [android-actions/setup-android](https://github.com/android-actions/setup-android) from 2.0.6 to 2.0.7. - [Release notes](https://github.com/android-actions/setup-android/releases) - [Commits](https://github.com/android-actions/setup-android/compare/v2.0.6...v2.0.7) Signed-off-by: dependabot[bot] --- .github/workflows/api-level-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/api-level-lint.yml b/.github/workflows/api-level-lint.yml index 5a1aca187..cf0413555 100644 --- a/.github/workflows/api-level-lint.yml +++ b/.github/workflows/api-level-lint.yml @@ -20,7 +20,7 @@ jobs: distribution: 'adopt' java-version: 16 - name: Setup Android SDK - uses: android-actions/setup-android@v2.0.6 + uses: android-actions/setup-android@v2.0.7 - name: Add execution right to the script run: chmod +x gradlew working-directory: ./android From 00a250cc4f16691e9c81a23772edc9c14200f3c6 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 26 May 2021 11:34:45 -0400 Subject: [PATCH 11/14] - fixes #213 changes annotations to nonnull for build request methods --- .../microsoft/graph/http/BaseCollectionRequestBuilder.java | 4 ++-- .../com/microsoft/graph/http/BaseReferenceRequestBuilder.java | 4 ++-- .../microsoft/graph/http/BaseWithReferenceRequestBuilder.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/microsoft/graph/http/BaseCollectionRequestBuilder.java b/src/main/java/com/microsoft/graph/http/BaseCollectionRequestBuilder.java index 977fc8255..eb2239a39 100644 --- a/src/main/java/com/microsoft/graph/http/BaseCollectionRequestBuilder.java +++ b/src/main/java/com/microsoft/graph/http/BaseCollectionRequestBuilder.java @@ -46,7 +46,7 @@ public BaseCollectionRequestBuilder(@Nonnull final String requestUrl, @Nonnull f * @param requestOptions the options for this request * @return the IUserRequest instance */ - @Nullable + @Nonnull public T5 buildRequest(@Nullable final com.microsoft.graph.options.Option... requestOptions) { return buildRequest(getOptions(requestOptions)); } @@ -57,7 +57,7 @@ public T5 buildRequest(@Nullable final com.microsoft.graph.options.Option... req * @param requestOptions the options for this request * @return the IUserRequest instance */ - @Nullable + @Nonnull public T5 buildRequest(@Nullable final java.util.List requestOptions) { try { return collRequestClass.getConstructor(String.class, IBaseClient.class, java.util.List.class) diff --git a/src/main/java/com/microsoft/graph/http/BaseReferenceRequestBuilder.java b/src/main/java/com/microsoft/graph/http/BaseReferenceRequestBuilder.java index 0f584c462..ccb81c043 100644 --- a/src/main/java/com/microsoft/graph/http/BaseReferenceRequestBuilder.java +++ b/src/main/java/com/microsoft/graph/http/BaseReferenceRequestBuilder.java @@ -57,7 +57,7 @@ public BaseReferenceRequestBuilder(@Nonnull final String requestUrl, @Nonnull fi * @param requestOptions the options for this request * @return The ReferenceRequest instance */ - @Nullable + @Nonnull public T2 buildRequest(@Nullable final com.microsoft.graph.options.Option... requestOptions) { return buildRequest(getOptions(requestOptions)); } @@ -68,7 +68,7 @@ public T2 buildRequest(@Nullable final com.microsoft.graph.options.Option... req * @param requestOptions the options for this request * @return the ReferenceRequest instance */ - @Nullable + @Nonnull public T2 buildRequest(@Nullable final java.util.List requestOptions) { try { return refRequestClass.getConstructor(String.class, IBaseClient.class, java.util.List.class) diff --git a/src/main/java/com/microsoft/graph/http/BaseWithReferenceRequestBuilder.java b/src/main/java/com/microsoft/graph/http/BaseWithReferenceRequestBuilder.java index b1ffe4d09..a6132c512 100644 --- a/src/main/java/com/microsoft/graph/http/BaseWithReferenceRequestBuilder.java +++ b/src/main/java/com/microsoft/graph/http/BaseWithReferenceRequestBuilder.java @@ -63,7 +63,7 @@ public BaseWithReferenceRequestBuilder(@Nonnull final String requestUrl, @Nonnul * @param requestOptions the options for this request * @return the ReferenceRequest instance */ - @Nullable + @Nonnull public T2 buildRequest(@Nullable final com.microsoft.graph.options.Option... requestOptions) { return buildRequest(getOptions(requestOptions)); } @@ -74,7 +74,7 @@ public T2 buildRequest(@Nullable final com.microsoft.graph.options.Option... req * @param requestOptions the options for this request * @return the ReferenceRequest instance */ - @Nullable + @Nonnull public T2 buildRequest(@Nullable final java.util.List requestOptions) { try { return wReferenceRequestClass.getConstructor(String.class, IBaseClient.class, java.util.List.class) From 78845176205ede7030ddfdf12337ca5ac8ddca13 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 26 May 2021 11:35:30 -0400 Subject: [PATCH 12/14] - bumps patch version number --- gradle.properties | 2 +- readme.md | 4 ++-- .../java/com/microsoft/graph/httpcore/TelemetryHandler.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 93527857c..f3c38535b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,7 +25,7 @@ mavenGroupId = com.microsoft.graph mavenArtifactId = microsoft-graph-core mavenMajorVersion = 2 mavenMinorVersion = 0 -mavenPatchVersion = 2 +mavenPatchVersion = 3 mavenArtifactSuffix = #These values are used to run functional tests diff --git a/readme.md b/readme.md index 41f48045e..815a9d2af 100644 --- a/readme.md +++ b/readme.md @@ -20,7 +20,7 @@ repositories { dependencies { // Include the sdk as a dependency - implementation 'com.microsoft.graph:microsoft-graph-core:2.0.2' + implementation 'com.microsoft.graph:microsoft-graph-core:2.0.3' // This dependency is only needed if you are using the TokenCrendentialAuthProvider implementation 'com.azure:azure-identity:1.2.5' } @@ -35,7 +35,7 @@ Add the dependency in `dependencies` in pom.xml com.microsoft.graph microsoft-graph-core - 2.0.2 + 2.0.3 com.azure azure-identity diff --git a/src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java b/src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java index 0d8f04962..a8f18be66 100644 --- a/src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java +++ b/src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java @@ -25,7 +25,7 @@ public class TelemetryHandler implements Interceptor{ /** * Current SDK version */ - public static final String VERSION = "v2.0.2"; + public static final String VERSION = "v2.0.3"; /** * Verion prefix */ From 859776ae03f44e5442d73f5801c103fa46645e49 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 26 May 2021 12:54:56 -0400 Subject: [PATCH 13/14] - fixes #209 a bug where batch errors would not respect configured log level --- .../microsoft/graph/content/BatchResponseStep.java | 13 +++++++++++-- .../graph/serializer/DefaultSerializer.java | 1 - 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/microsoft/graph/content/BatchResponseStep.java b/src/main/java/com/microsoft/graph/content/BatchResponseStep.java index feb1d13a1..659761385 100644 --- a/src/main/java/com/microsoft/graph/content/BatchResponseStep.java +++ b/src/main/java/com/microsoft/graph/content/BatchResponseStep.java @@ -33,6 +33,9 @@ import com.microsoft.graph.http.GraphErrorResponse; import com.microsoft.graph.http.GraphFatalServiceException; import com.microsoft.graph.http.GraphServiceException; +import com.microsoft.graph.logger.ILogger; +import com.microsoft.graph.logger.LoggerLevel; +import com.microsoft.graph.serializer.DefaultSerializer; import com.microsoft.graph.serializer.ISerializer; /** Response for the batch step */ @@ -61,7 +64,13 @@ public T2 getDeserializedBody(@Nonnull final Class resultClass) throws final GraphErrorResponse error = serializer.deserializeObject((JsonElement)body, GraphErrorResponse.class); if(error == null || error.error == null) { return serializer.deserializeObject((JsonElement)body, resultClass); - } else - throw GraphServiceException.createFromResponse("", "", new ArrayList<>(), "", headers, "", status, error, false); + } else { + boolean verboseError = false; + if(serializer instanceof DefaultSerializer) { + final ILogger logger = ((DefaultSerializer)serializer).getLogger(); + verboseError = logger != null && logger.getLoggingLevel() == LoggerLevel.DEBUG; + } + throw GraphServiceException.createFromResponse("", "", new ArrayList<>(), "", headers, "", status, error, verboseError); + } } } diff --git a/src/main/java/com/microsoft/graph/serializer/DefaultSerializer.java b/src/main/java/com/microsoft/graph/serializer/DefaultSerializer.java index bf520e224..ec9f7999c 100644 --- a/src/main/java/com/microsoft/graph/serializer/DefaultSerializer.java +++ b/src/main/java/com/microsoft/graph/serializer/DefaultSerializer.java @@ -393,7 +393,6 @@ public Class getDerivedClass(@Nonnull final JsonObject jsonObject, @Nullable * * @return a logger */ - @VisibleForTesting @Nullable public ILogger getLogger() { return logger; From 96ac49f93bda13862fe914b2a1e737f907f59e21 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 26 May 2021 14:58:22 -0400 Subject: [PATCH 14/14] - adds unit tests for batch response steps exception verbosity --- .../content/BatchResponseContentTest.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/test/java/com/microsoft/graph/content/BatchResponseContentTest.java b/src/test/java/com/microsoft/graph/content/BatchResponseContentTest.java index 6414b7252..a39b9255b 100644 --- a/src/test/java/com/microsoft/graph/content/BatchResponseContentTest.java +++ b/src/test/java/com/microsoft/graph/content/BatchResponseContentTest.java @@ -14,7 +14,9 @@ import com.google.gson.JsonElement; import com.microsoft.graph.http.GraphErrorResponse; import com.microsoft.graph.http.GraphServiceException; +import com.microsoft.graph.logger.DefaultLogger; import com.microsoft.graph.logger.ILogger; +import com.microsoft.graph.logger.LoggerLevel; import com.microsoft.graph.serializer.DefaultSerializer; import com.microsoft.graph.serializer.ISerializer; @@ -114,4 +116,52 @@ public void deserializesErrorsProperly() { } else fail("batch response was null"); } + @Test + public void includeVerboseInformation() { + String responsebody = "{\"responses\":[{\"id\":\"1\",\"status\":400,\"headers\":{\"Cache-Control\":\"no-cache\",\"x-ms-resource-unit\":\"1\",\"Content-Type\":\"application/json\"},\"body\":{\"error\":{\"code\":\"Request_BadRequest\",\"message\":\"Avalueisrequiredforproperty'displayName'ofresource'User'.\",\"innerError\":{\"date\":\"2021-02-02T19:19:38\",\"request-id\":\"408b8e64-4047-4c97-95b6-46e9f212ab48\",\"client-request-id\":\"102910da-260c-3028-0fb3-7d6903a02622\"}}}}]}"; + ISerializer serializer = new DefaultSerializer(new DefaultLogger() {{ + setLoggingLevel(LoggerLevel.DEBUG); + }}); + BatchResponseContent batchresponse = serializer.deserializeObject(responsebody, BatchResponseContent.class); + if(batchresponse != null) { + if(batchresponse.responses != null) // this is done by the batch request in the fluent API + for(final BatchResponseStep step : batchresponse.responses) { + step.serializer = serializer; + } + try { + batchresponse.getResponseById("1").getDeserializedBody(BatchRequestContent.class); + } catch(GraphServiceException ex) { + final GraphErrorResponse response = ex.getError(); + assertNotNull(response); + assertNotNull(response.error); + assertNotNull(response.error.message); + assertEquals(ex.getMessage(true), ex.getMessage()); + } + } else + fail("batch response was null"); + } + @Test + public void doesNotIncludeVerboseInformation() { + String responsebody = "{\"responses\":[{\"id\":\"1\",\"status\":400,\"headers\":{\"Cache-Control\":\"no-cache\",\"x-ms-resource-unit\":\"1\",\"Content-Type\":\"application/json\"},\"body\":{\"error\":{\"code\":\"Request_BadRequest\",\"message\":\"Avalueisrequiredforproperty'displayName'ofresource'User'.\",\"innerError\":{\"date\":\"2021-02-02T19:19:38\",\"request-id\":\"408b8e64-4047-4c97-95b6-46e9f212ab48\",\"client-request-id\":\"102910da-260c-3028-0fb3-7d6903a02622\"}}}}]}"; + ISerializer serializer = new DefaultSerializer(new DefaultLogger() {{ + setLoggingLevel(LoggerLevel.ERROR); + }}); + BatchResponseContent batchresponse = serializer.deserializeObject(responsebody, BatchResponseContent.class); + if(batchresponse != null) { + if(batchresponse.responses != null) // this is done by the batch request in the fluent API + for(final BatchResponseStep step : batchresponse.responses) { + step.serializer = serializer; + } + try { + batchresponse.getResponseById("1").getDeserializedBody(BatchRequestContent.class); + } catch(GraphServiceException ex) { + final GraphErrorResponse response = ex.getError(); + assertNotNull(response); + assertNotNull(response.error); + assertNotNull(response.error.message); + assertEquals(ex.getMessage(false), ex.getMessage()); + } + } else + fail("batch response was null"); + } }