Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
id 'maven-publish'
id 'signing'
id 'jacoco'
id 'com.github.spotbugs' version '5.0.6'
id 'com.github.spotbugs' version '5.0.7'
id "org.sonarqube" version "3.3"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

package com.microsoft.graph.http;


import com.microsoft.graph.logger.ILogger;
import com.microsoft.graph.serializer.ISerializer;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import javax.annotation.Nullable;
import javax.annotation.Nonnull;
Expand All @@ -50,6 +50,7 @@ public interface IStatefulResponseHandler<ResultType, DeserializedType> {
* @throws Exception an exception occurs if the request was unable to complete for any reason
*/
@Nullable
@SuppressFBWarnings
<ResponseType> ResultType generateResult(@Nonnull final IHttpRequest request,
@Nonnull final ResponseType response,
@Nonnull final ISerializer serializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import okhttp3.MediaType;
import okhttp3.Response;
import okhttp3.ResponseBody;
Expand Down Expand Up @@ -72,6 +73,7 @@ protected LargeFileUploadResponseHandler(@Nonnull final Class<UploadType> upload

@Override
@Nullable
@SuppressFBWarnings
public <ResponseType> LargeFileUploadResponse<UploadType> generateResult(
@Nonnull final IHttpRequest request,
@Nonnull final ResponseType response,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.core.IBaseClient;
import com.microsoft.graph.options.Option;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -99,6 +100,7 @@ public class LargeFileUploadTask<UploadType> {
* @param streamSize the stream size
* @param uploadTypeClass the upload type class
*/
@SuppressFBWarnings
public LargeFileUploadTask(@Nonnull final IUploadSession uploadSession,
@Nonnull final IBaseClient<?> client,
@Nonnull final InputStream inputStream,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.azure.core.credential.TokenCredential;
import com.microsoft.graph.mocks.MockTokenCredential;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;
Expand All @@ -13,6 +14,7 @@
import java.util.ArrayList;
import java.util.concurrent.ExecutionException;

@SuppressFBWarnings
public class TokenCredentialAuthProviderTest {

private static final String testToken = "CredentialTestToken";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.microsoft.graph.serializer.IJsonBackedObject;
import com.microsoft.graph.serializer.ISerializer;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand All @@ -41,6 +42,7 @@
import okhttp3.Response;
import okhttp3.ResponseBody;

@SuppressFBWarnings
class BatchRequestContentTest {

String testurl = "http://graph.microsoft.com/v1.0/me";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
import com.microsoft.graph.serializer.DefaultSerializer;
import com.microsoft.graph.serializer.ISerializer;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;

@SuppressFBWarnings
public class BatchResponseContentTest {
@Test
public void testValidBatchResponseContent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class BaseClientTests {
private ISerializer mSerializer;

@BeforeEach
public void setUp() throws Exception {
public void setUp() {
baseClient = new BaseClient<>();
mLogger = mock(ILogger.class);
mSerializer = mock(ISerializer.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ClientExceptionTests {
private String expectMessage = "This is test exception message";

@BeforeEach
public void setUp() throws Exception {
public void setUp() {
clientException = new ClientException(expectMessage, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.Map;
import java.util.concurrent.CompletableFuture;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;

import okhttp3.Request;
Expand All @@ -28,6 +29,7 @@

import javax.annotation.Nullable;

@SuppressFBWarnings
public class GraphServiceClientTest {
private IAuthenticationProvider getAuthProvider() {
return mock(IAuthenticationProvider.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class BaseCollectionPageTests {

@BeforeEach
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
public void setUp() {
list = new ArrayList<String>();
list.add("Object1");
list.add("Object2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.microsoft.graph.options.QueryOption;
import com.microsoft.graph.serializer.ISerializer;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -56,6 +57,7 @@ public class BaseCollectionRequestTests {
private BaseEntityCollectionRequest<JsonObject, ICollectionResponse<JsonObject>, BaseCollectionPage<JsonObject, BaseRequestBuilder<JsonObject>>> mRequest;

@BeforeEach
@SuppressFBWarnings
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
mBaseClient = mock(IBaseClient.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class BaseRequestBuilderTests {
private BaseRequestBuilder<String> baseRequestBuilder;

@BeforeEach
public void setUp() throws Exception {
public void setUp() {
baseRequestBuilder = new BaseRequestBuilder<>(expectedRequestUrl, mock(IBaseClient.class), null){};
}

Expand Down
2 changes: 2 additions & 0 deletions src/test/java/com/microsoft/graph/http/BaseRequestTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import static org.mockito.Mockito.mock;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand All @@ -37,6 +38,7 @@ public class BaseRequestTests {
private BaseRequest<JsonObject> mRequest;

@BeforeEach
@SuppressFBWarnings
public void setUp() throws Exception {
final Response response = new Response.Builder()
.request(new Request.Builder().url("https://a.b.c").build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.InputStream;
import java.util.concurrent.ExecutionException;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.stubbing.Answer;
Expand All @@ -33,13 +34,14 @@
/**
* Test cases for {@see BaseStreamRequest}
*/
@SuppressFBWarnings
public class BaseStreamRequestTests {

private BaseClient<Request> mBaseClient;

@BeforeEach
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
public void setUp() {
mBaseClient = mock(BaseClient.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
import java.io.IOException;
import java.util.concurrent.ExecutionException;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;

import okhttp3.Call;
import okhttp3.Response;

@SuppressFBWarnings
class CoreHttpCallbackFutureWrapperTests {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.microsoft.graph.serializer.DefaultSerializer;
import com.microsoft.graph.serializer.ISerializer;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import okio.Buffer;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -62,6 +63,7 @@ class CoreHttpProviderTests {
private Gson GSON = new GsonBuilder().create();

@Test
@SuppressFBWarnings
void testErrorResponse() throws Exception {
final GraphErrorCodes expectedErrorCode = GraphErrorCodes.INVALID_REQUEST;
final String expectedMessage = "Test error!";
Expand All @@ -85,6 +87,7 @@ void testErrorResponse() throws Exception {
}

@Test
@SuppressFBWarnings
void testVerboseErrorResponse() throws Exception {
final GraphErrorCodes expectedErrorCode = GraphErrorCodes.INVALID_REQUEST;
final String expectedMessage = "Test error!";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
import java.net.URL;
import java.util.concurrent.CompletableFuture;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;

import okhttp3.OkHttpClient;
import okhttp3.Request;

public class AuthenticationHandlerTest {
@Test
@SuppressFBWarnings
public void testAuthenticationHandler() throws Exception {
IAuthenticationProvider authProvider = mock(IAuthenticationProvider.class);
when(authProvider.getAuthorizationTokenAsync(any(URL.class))).thenReturn(CompletableFuture.completedFuture("a token"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.io.IOException;
import java.net.HttpURLConnection;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;

import com.microsoft.graph.httpcore.middlewareoption.IShouldRetry;
Expand All @@ -21,6 +22,7 @@
import okhttp3.Response;
import okio.BufferedSink;

@SuppressFBWarnings
public class RetryHandlerTest {

private static final String testmeurl = "https://graph.microsoft.com/v1.0/me";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;

import okhttp3.Response;

@SuppressFBWarnings
public class RedirectOptionsTest {
@Test
public void constructorDefensiveProgramming() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;

@SuppressFBWarnings
public class RetryOptionsTest {
@Test
public void constructorDefensiveProgramming() {
@SuppressFBWarnings
public void constructorDefensiveProgramming() throws IllegalArgumentException {
assertThrows(IllegalArgumentException.class, () -> {
new RetryOptions(null, RetryOptions.MAX_RETRIES +1, 0);
});
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/com/microsoft/graph/options/OptionTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;

@SuppressFBWarnings
public class OptionTests {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;

public class ByteArraySerializerTests {

@Test
public void testByteSerialization() throws Exception {
public void testByteSerialization() {
String expectedString = "abcd";
String serializeString = ByteArraySerializer.serialize(new byte[]{105,-73,29});
assertEquals(expectedString, serializeString);
assertFalse(ByteArraySerializer.serialize(new byte[]{1,2,3}).equals(ByteArraySerializer.serialize(new byte[]{1,2,3,4})));
}

@Test
@SuppressFBWarnings
public void testStringDeserialization() throws Exception {
byte[] deserializeBytes = ByteArraySerializer.deserialize("abcd");
assertEquals(3, deserializeBytes.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;

import com.microsoft.graph.core.DateOnly;

@SuppressFBWarnings
public class DateOnlyTests {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.junit.jupiter.api.Test;

@SuppressFBWarnings
public class DurationTests {

@Test
Expand Down
Loading