Skip to content

Commit

Permalink
refactor: Fix code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-frak committed Dec 2, 2024
1 parent 93076a6 commit 0f6a701
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
/**
* Provides legacy user migration functionality
*/
@SuppressWarnings("java:S1200") // NO easy way to reduce the dependencies of this class
@SuppressWarnings(
// No easy way to reduce the dependencies of this class:
"java:S1200"
)
public class LegacyProvider implements UserStorageProvider,
UserLookupProvider,
CredentialInputUpdater,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public static LegacyUser aMinimalLegacyUser() {
"Smith",
true,
true,
emptyMap(),
emptyList(),
emptyList(),
emptyList(),
emptyList()
null,
null,
null,
null,
null
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public Long getCreatedTimestamp() {

@Override
public void setCreatedTimestamp(Long timestamp) {

// Do nothing
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;
import okhttp3.mockwebserver.SocketPolicy;
import okio.Buffer;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.LaxRedirectStrategy;
Expand All @@ -31,8 +28,8 @@

import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.willAnswer;
import static org.mockito.Mockito.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

class HttpClientTest {

Expand All @@ -45,7 +42,7 @@ void setUp() throws IOException {
mockWebServer = new MockWebServer();
mockWebServer.start();
httpClient = new HttpClient(HttpClientBuilder.create().setRedirectStrategy(new LaxRedirectStrategy()));
uri = String.format("http://" + mockWebServer.getHostName() + ":%s/", mockWebServer.getPort());
uri = String.format("http://%s:%s/", mockWebServer.getHostName(), mockWebServer.getPort());
}

@AfterEach
Expand All @@ -56,7 +53,7 @@ void afterEach() throws IOException {
@Test
void getShouldThrowIfResponseThrows() {
var mockResponse = new MockResponse()
.setBody(new Buffer().write(new byte[4096]))
.setBody("testBody")
.setSocketPolicy(SocketPolicy.DISCONNECT_DURING_RESPONSE_BODY);
mockWebServer.enqueue(mockResponse);

Expand Down Expand Up @@ -255,7 +252,7 @@ void getShouldSupportCustomResponseEncoding() throws InterruptedException {
@Test
void postShouldThrowIfResponseThrows() {
var mockResponse = new MockResponse()
.setBody(new Buffer().write(new byte[4096]))
.setBody("testBody")
.setSocketPolicy(SocketPolicy.DISCONNECT_DURING_RESPONSE_BODY);
mockWebServer.enqueue(mockResponse);

Expand Down

0 comments on commit 0f6a701

Please sign in to comment.