Skip to content

Commit

Permalink
spotless:apply
Browse files Browse the repository at this point in the history
  • Loading branch information
mwangggg committed Oct 19, 2023
1 parent 48c0737 commit e4b8a21
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
import io.cryostat.net.TargetConnectionManager;
import io.cryostat.net.web.WebModule;
import io.cryostat.net.web.WebServer;
import io.cryostat.net.web.http.HttpMimeType;
import io.cryostat.net.web.http.api.v2.ApiException;
import io.cryostat.platform.PlatformClient;
import io.cryostat.recordings.JvmIdHelper.JvmIdGetException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ class RecordingsFromIdPostHandlerTest {

@BeforeEach
void setup() {
lenient().when(notificationFactory.createOwnedResourceBuilder(Mockito.anyString())).thenReturn(notificationBuilder);
lenient()
.when(notificationFactory.createOwnedResourceBuilder(Mockito.anyString()))
.thenReturn(notificationBuilder);
lenient()
.when(notificationBuilder.metaCategory(Mockito.any()))
.thenReturn(notificationBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ public class TargetProbePostHandlerTest {

@BeforeEach
void setup() {
lenient().when(notificationFactory.createOwnedResourceBuilder(Mockito.anyString())).thenReturn(notificationBuilder);
lenient()
.when(notificationFactory.createOwnedResourceBuilder(Mockito.anyString()))
.thenReturn(notificationBuilder);
lenient()
.when(notificationBuilder.metaCategory(Mockito.any()))
.thenReturn(notificationBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ class RecordingArchiveHelperTest {
@BeforeEach
void setup() {
lenient().when(notificationFactory.createBuilder()).thenReturn(notificationBuilder);
lenient().when(notificationFactory.createOwnedResourceBuilder(Mockito.anyString())).thenReturn(notificationBuilder);
lenient()
.when(notificationFactory.createOwnedResourceBuilder(Mockito.anyString()))
.thenReturn(notificationBuilder);
lenient()
.when(notificationBuilder.metaCategory(Mockito.any()))
.thenReturn(notificationBuilder);
Expand Down Expand Up @@ -266,7 +268,8 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
MatcherAssert.assertThat(info.getName(), Matchers.equalTo(savedName));
Mockito.verify(fs).copy(Mockito.isA(BufferedInputStream.class), Mockito.eq(destination));
Mockito.verify(notificationFactory).createOwnedResourceBuilder("ActiveRecordingSaved");
Mockito.verify(notificationBuilder).message(Map.of("recording", info, "target", targetId, "jvmId", "mockId"));
Mockito.verify(notificationBuilder)
.message(Map.of("recording", info, "target", targetId, "jvmId", "mockId"));
Mockito.verify(notificationBuilder).build();
Mockito.verify(notification).send();
}
Expand Down Expand Up @@ -440,7 +443,8 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
MatcherAssert.assertThat(info.getName(), Matchers.equalTo(savedName));
Mockito.verify(fs).copy(Mockito.isA(BufferedInputStream.class), Mockito.eq(destination));
Mockito.verify(notificationFactory).createOwnedResourceBuilder("ActiveRecordingSaved");
Mockito.verify(notificationBuilder).message(Map.of("recording", info, "target", targetId, "jvmId", "mockId"));
Mockito.verify(notificationBuilder)
.message(Map.of("recording", info, "target", targetId, "jvmId", "mockId"));
Mockito.verify(notificationBuilder).build();
Mockito.verify(notification).send();
}
Expand Down Expand Up @@ -519,7 +523,8 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
MatcherAssert.assertThat(info.getName(), Matchers.equalTo(savedName));
Mockito.verify(fs).copy(Mockito.isA(BufferedInputStream.class), Mockito.eq(destination));
Mockito.verify(notificationFactory).createOwnedResourceBuilder("ActiveRecordingSaved");
Mockito.verify(notificationBuilder).message(Map.of("recording", info, "target", targetId, "jvmId", "mockId"));
Mockito.verify(notificationBuilder)
.message(Map.of("recording", info, "target", targetId, "jvmId", "mockId"));
Mockito.verify(notificationBuilder).build();
Mockito.verify(notification).send();
}
Expand Down Expand Up @@ -605,7 +610,8 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
MatcherAssert.assertThat(info.getName(), Matchers.equalTo(savedName));
Mockito.verify(fs).copy(Mockito.isA(BufferedInputStream.class), Mockito.eq(destination));
Mockito.verify(notificationFactory).createOwnedResourceBuilder("ActiveRecordingSaved");
Mockito.verify(notificationBuilder).message(Map.of("recording", info, "target", targetId, "jvmId", "mockId"));
Mockito.verify(notificationBuilder)
.message(Map.of("recording", info, "target", targetId, "jvmId", "mockId"));
Mockito.verify(notificationBuilder).build();
Mockito.verify(notification).send();
}
Expand Down Expand Up @@ -744,7 +750,8 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
MatcherAssert.assertThat(info.getName(), Matchers.equalTo(savedName));
Mockito.verify(fs).copy(Mockito.isA(BufferedInputStream.class), Mockito.eq(destination));
Mockito.verify(notificationFactory).createOwnedResourceBuilder("ActiveRecordingSaved");
Mockito.verify(notificationBuilder).message(Map.of("recording", info, "target", targetId, "jvmId", "mockId"));
Mockito.verify(notificationBuilder)
.message(Map.of("recording", info, "target", targetId, "jvmId", "mockId"));
Mockito.verify(notificationBuilder).build();
Mockito.verify(notification).send();
}
Expand Down Expand Up @@ -845,7 +852,8 @@ public String answer(InvocationOnMock invocation) throws Throwable {

MatcherAssert.assertThat(
messageCaptor.getValue(),
Matchers.equalTo(Map.of("recording", matcher, "target", "uploads", "jvmId", "mockId")));
Matchers.equalTo(
Map.of("recording", matcher, "target", "uploads", "jvmId", "mockId")));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ void setup() {
Base32 base32 = new Base32();

lenient().when(notificationFactory.createBuilder()).thenReturn(notificationBuilder);
lenient().when(notificationFactory.createOwnedResourceBuilder(Mockito.anyString())).thenReturn(notificationBuilder);
lenient()
.when(notificationFactory.createOwnedResourceBuilder(Mockito.anyString()))
.thenReturn(notificationBuilder);
lenient()
.when(notificationBuilder.metaCategory(Mockito.any()))
.thenReturn(notificationBuilder);
Expand All @@ -115,10 +117,10 @@ public String answer(InvocationOnMock invocation) throws Throwable {
.when(jvmIdHelper.subdirectoryNameToJvmId(Mockito.anyString()))
.thenAnswer(
new Answer<String>() {
@Override
public String answer(InvocationOnMock invocation) throws Throwable {
@Override
public String answer(InvocationOnMock invocation) throws Throwable {
return invocation.getArgument(0);
}
}
});

this.recordingMetadataManager =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ public class RecordingTargetHelperTest {
@BeforeEach
void setup() {
lenient().when(notificationFactory.createBuilder()).thenReturn(notificationBuilder);
lenient().when(notificationFactory.createOwnedResourceBuilder(Mockito.anyString())).thenReturn(notificationBuilder);
lenient()
.when(notificationFactory.createOwnedResourceBuilder(Mockito.anyString()))
.thenReturn(notificationBuilder);
lenient()
.when(notificationBuilder.metaCategory(Mockito.any()))
.thenReturn(notificationBuilder);
Expand Down Expand Up @@ -586,7 +588,8 @@ void shouldVerifySnapshotWithoutNotification() throws Exception {
.verifySnapshot(connectionDescriptor, snapshotDescriptor, false)
.get();

Mockito.verify(notificationFactory, Mockito.never()).createOwnedResourceBuilder("SnapshotCreated");
Mockito.verify(notificationFactory, Mockito.never())
.createOwnedResourceBuilder("SnapshotCreated");
Mockito.verify(notificationBuilder, Mockito.never())
.message(Map.of("recording", snapshotDescriptor, "target", "fooTarget"));
Mockito.verify(notificationBuilder, Mockito.never()).build();
Expand Down

0 comments on commit e4b8a21

Please sign in to comment.