Skip to content

Commit

Permalink
fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CameronRushton committed Aug 21, 2024
1 parent 3353265 commit 563c6ac
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static RoutesBuilder createRouteBuilder() {
SolacePublisher solacePublisher = mock(SolacePublisher.class);
EventPortalProperties eventPortalProperties = mock(EventPortalProperties.class);
MeterRegistry meterRegistry = mock(MeterRegistry.class);
when(meterRegistry.counter(any(), any(), any(), any(), any(), any(), any(), any(), any()))
when(meterRegistry.counter(any(), any(String[].class)))
.thenReturn(new NoopCounter(new Meter.Id("noop", null, null, null, null)));

ScanDataPublisher scanDataPublisher = new ScanDataPublisher(solacePublisher, meterRegistry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import com.solace.maas.ep.event.management.agent.repository.scan.ScanTypeRepository;
import com.solace.maas.ep.event.management.agent.service.logging.LoggingService;
import com.solace.maas.ep.event.management.agent.util.IDGenerator;
import io.micrometer.core.instrument.Meter;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.noop.NoopCounter;
import lombok.SneakyThrows;
import org.apache.camel.Processor;
import org.apache.camel.Produce;
Expand Down Expand Up @@ -96,7 +98,7 @@ public class ScanServiceTests {
@Autowired
private ScanServiceHelper scanServiceHelper;

@Autowired
@Mock
private MeterRegistry meterRegistry;

@Test
Expand Down Expand Up @@ -147,9 +149,10 @@ public void testSingleScanWithRouteBundle() {
.thenReturn(scanType);
when(scanStatusRepository.save(scanStatus))
.thenReturn(scanStatus);

when(scanRecipientHierarchyRepository.save(any(ScanRecipientHierarchyEntity.class)))
.thenReturn(mock(ScanRecipientHierarchyEntity.class));
when(meterRegistry.counter(any(), any(String[].class)))
.thenReturn(new NoopCounter(new Meter.Id("noop", null, null, null, null)));

scanService.singleScan(List.of(topicListing, consumerGroups, additionalConsumerGroupConfigBundle),
"groupId",
Expand Down Expand Up @@ -314,6 +317,8 @@ public void testParseRouteRecipients() {
@Test
@SneakyThrows
public void testSendScanStatus() {
when(meterRegistry.counter(any(), any(String[].class)))
.thenReturn(new NoopCounter(new Meter.Id("noop", null, null, null, null)));
ScanService service = new ScanService(mock(ScanRepository.class), mock(ScanRecipientHierarchyRepository.class),
mock(ScanTypeRepository.class),
mock(ScanStatusRepository.class), mock(ScanRouteService.class), mock(RouteService.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void scanReceiver() {
when(inboundMessage.getProperty(MOPConstants.MOP_MSG_META_DECODER)).thenReturn(
"com.solace.maas.ep.common.messages.ScanCommandMessage");
when(inboundMessage.getDestinationName()).thenReturn("anyTopic");
when(meterRegistry.counter(any(), any(), any(), any(), any(), any(), any())).thenReturn(new NoopCounter(
when(meterRegistry.counter(any(), any(String[].class))).thenReturn(new NoopCounter(
new Meter.Id("mockMeterId", null, null, null, null)));

ScanCommandMessageHandler scanCommandMessageHandler = new ScanCommandMessageHandler(
Expand Down Expand Up @@ -123,7 +123,7 @@ public void testBadClass() {
@Test
@SneakyThrows
public void testScanCommandMessage() {
when(meterRegistry.counter(any(), any(), any(), any(), any(), any(), any())).thenReturn(new NoopCounter(
when(meterRegistry.counter(any(), any(String[].class))).thenReturn(new NoopCounter(
new Meter.Id("mockMeterId", null, null, null, null)));
ScanCommandMessageHandler scanCommandMessageHandler = new ScanCommandMessageHandler(
solaceConfiguration, solaceSubscriber, scanCommandMessageProcessor, meterRegistry);
Expand Down

0 comments on commit 563c6ac

Please sign in to comment.