Java Code Examples for io.vavr.collection.Seq#get()

The following examples show how to use io.vavr.collection.Seq#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AriEventProcessingTest.java    From ari-proxy with GNU Affero General Public License v3.0 6 votes vote down vote up
@Test
void verifyTheRequiredMetricsAreGatheredForStasisStart() {
	final Seq<MetricsGatherer> metricsGatherers = AriEventProcessing
			.determineMetricsGatherer(AriMessageType.STASIS_START);

	metricsGatherers.forEach(metricsGatherer -> {
		final Object metricsReq = metricsGatherer.withCallContextSupplier(() -> "CALL_CONTEXT");
		System.out.println(metricsReq);
	});

	final Seq<Object> metricsRequests = metricsGatherers
			.map(metricsGatherer -> metricsGatherer.withCallContextSupplier(() -> "CALL_CONTEXT"));

	assertThat(len(metricsGatherers), is(3));

	final IncreaseCounter eventTypeCounter = (IncreaseCounter) metricsRequests.get(0);
	final IncreaseCounter callsStartedCounter = (IncreaseCounter) metricsRequests.get(1);
	final StartCallSetupTimer callSetupTimer = (StartCallSetupTimer) metricsRequests.get(2);

	assertThat(eventTypeCounter.getName(), is(AriMessageType.STASIS_START.name()));
	assertThat(callsStartedCounter.getName(), is("CallsStarted"));
	assertThat(callSetupTimer.getCallContext(), is("CALL_CONTEXT"));
}
 
Example 2
Source File: AriEventProcessingTest.java    From ari-proxy with GNU Affero General Public License v3.0 6 votes vote down vote up
@Test
void verifyTheRequiredMetricsAreGatheredForStasisEnd() {
	final Seq<MetricsGatherer> metricsGatherers = AriEventProcessing
			.determineMetricsGatherer(AriMessageType.STASIS_END);

	final Seq<Object> metricsRequests = metricsGatherers
			.map(metricsGatherer -> metricsGatherer.withCallContextSupplier(() -> "CALL_CONTEXT"));

	assertThat(len(metricsGatherers), is(2));

	final IncreaseCounter eventTypeCounter = (IncreaseCounter) metricsRequests.get(0);
	final IncreaseCounter callsEndedCounter = (IncreaseCounter) metricsRequests.get(1);

	assertThat(eventTypeCounter.getName(), is(AriMessageType.STASIS_END.name()));
	assertThat(callsEndedCounter.getName(), is("CallsEnded"));
}