Merge branch 'master' into BAEL-981_pact
This commit is contained in:
commit
cc554188d8
|
@ -0,0 +1,3 @@
|
|||
### Relevant articles
|
||||
|
||||
- [Introduction to Asciidoctor](http://www.baeldung.com/introduction-to-asciidoctor)
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>asciidoctor</artifactId>
|
||||
<name>asciidoctor</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctorj-pdf</artifactId>
|
||||
<version>1.5.0-alpha.15</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>output-pdf</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>process-asciidoc</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<sourceDirectory>src/docs/asciidoc</sourceDirectory>
|
||||
<outputDirectory>target/docs/asciidoc</outputDirectory>
|
||||
<backend>pdf</backend>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctorj</artifactId>
|
||||
<version>1.5.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctorj-pdf</artifactId>
|
||||
<version>1.5.0-alpha.11</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -12,7 +12,6 @@ import static org.hamcrest.CoreMatchers.instanceOf;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class StringToCharStreamUnitTest {
|
||||
|
||||
|
@ -44,7 +43,6 @@ public class StringToCharStreamUnitTest {
|
|||
.mapToObj(c -> (char) c);
|
||||
Stream<Character> characterStream1 = testString.codePoints()
|
||||
.mapToObj(c -> (char) c);
|
||||
|
||||
assertNotNull("IntStream returned by chars() did not map to Stream<Character>", characterStream);
|
||||
assertNotNull("IntStream returned by codePoints() did not map to Stream<Character>", characterStream1);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
|
@ -59,7 +59,7 @@
|
|||
<props>${basedir}/datanucleus.properties</props>
|
||||
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
|
||||
<verbose>true</verbose>
|
||||
<fork>false</fork> <!-- Solve windows line too long error -->
|
||||
<fork>false</fork> <!-- Solve windows line too long error -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -70,32 +70,6 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctorj-pdf</artifactId>
|
||||
<version>1.5.0-alpha.15</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>output-pdf</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>process-asciidoc</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<sourceDirectory>src/docs/asciidoc</sourceDirectory>
|
||||
<outputDirectory>target/docs/asciidoc</outputDirectory>
|
||||
<backend>pdf</backend>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
@ -107,15 +81,20 @@
|
|||
<version>${cglib.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>${commons-beanutils.version}</version>
|
||||
</dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>${commons-beanutils.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons-lang.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
<version>${commons.collections.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jasypt</groupId>
|
||||
<artifactId>jasypt</artifactId>
|
||||
|
@ -211,12 +190,6 @@
|
|||
<artifactId>serenity-core</artifactId>
|
||||
<version>${serenity.version}</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-java-integration</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.serenity-bdd</groupId>
|
||||
|
@ -272,7 +245,7 @@
|
|||
<groupId>org.datanucleus</groupId>
|
||||
<artifactId>datanucleus-maven-plugin</artifactId>
|
||||
<version>5.0.2</version>
|
||||
</dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.datanucleus</groupId>
|
||||
<artifactId>datanucleus-xml</artifactId>
|
||||
|
@ -324,11 +297,11 @@
|
|||
<version>1.4.195</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pl.pragmatists</groupId>
|
||||
<artifactId>JUnitParams</artifactId>
|
||||
<version>${jUnitParams.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<groupId>pl.pragmatists</groupId>
|
||||
<artifactId>JUnitParams</artifactId>
|
||||
<version>${jUnitParams.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
|
@ -360,22 +333,18 @@
|
|||
<artifactId>netty-all</artifactId>
|
||||
<version>${netty.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctorj</artifactId>
|
||||
<version>1.5.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctorj-pdf</artifactId>
|
||||
<version>1.5.0-alpha.11</version>
|
||||
</dependency>
|
||||
<!-- OpenNLP -->
|
||||
<!-- OpenNLP -->
|
||||
<dependency>
|
||||
<groupId>org.apache.opennlp</groupId>
|
||||
<artifactId>opennlp-tools</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>info.debatty</groupId>
|
||||
<artifactId>java-lsh</artifactId>
|
||||
|
@ -392,14 +361,12 @@
|
|||
<artifactId>groovy-all</artifactId>
|
||||
<version>2.4.10</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
<properties>
|
||||
<multiverse.version>0.7.0</multiverse.version>
|
||||
<cglib.version>3.2.4</cglib.version>
|
||||
<commons-lang.version>3.5</commons-lang.version>
|
||||
<commons-beanutils.version>1.9.3</commons-beanutils.version>
|
||||
<commons-beanutils.version>1.9.3</commons-beanutils.version>
|
||||
<jasypt.version>1.9.2</jasypt.version>
|
||||
<javatuples.version>1.2</javatuples.version>
|
||||
<javaassist.version>3.21.0-GA</javaassist.version>
|
||||
|
@ -420,6 +387,8 @@
|
|||
<serenity.plugin.version>1.4.0</serenity.plugin.version>
|
||||
<jUnitParams.version>1.1.0</jUnitParams.version>
|
||||
<netty.version>4.1.10.Final</netty.version>
|
||||
<commons.collections.version>4.1</commons.collections.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
<java-lsh.version>0.10</java-lsh.version>
|
||||
<pact.version>3.5.0</pact.version>
|
||||
</properties>
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
package com.baeldung.commons.collections;
|
||||
|
||||
import org.apache.commons.collections4.SetUtils;
|
||||
import org.apache.commons.collections4.set.TransformedSet;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Created by smatt on 21/06/2017.
|
||||
*/
|
||||
public class SetUtilsUnitTest {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void givenSetAndPredicate_whenPredicatedSet_thenValidateSet_and_throw_IllegalArgumentException() {
|
||||
Set<String> sourceSet = new HashSet<>();
|
||||
sourceSet.addAll(Arrays.asList("London", "Lagos", "Err Source1"));
|
||||
Set<String> validatingSet
|
||||
= SetUtils.predicatedSet(sourceSet, (s) -> s.startsWith("L"));
|
||||
validatingSet.add("Err Source2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenTwoSets_whenDifference_thenSetView() {
|
||||
Set<Integer> a = new HashSet<>(Arrays.asList(1,2,5));
|
||||
Set<Integer> b = new HashSet<>(Arrays.asList(1,2));
|
||||
SetUtils.SetView<Integer> result = SetUtils.difference(a, b);
|
||||
assertTrue(result.size() == 1 && result.contains(5));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenTwoSets_whenUnion_thenUnionResult() {
|
||||
Set<Integer> a = new HashSet<>(Arrays.asList(1,2,5));
|
||||
Set<Integer> b = new HashSet<>(Arrays.asList(1,2));
|
||||
Set<Integer> expected = new HashSet<>(Arrays.asList(1,2,5));
|
||||
SetUtils.SetView<Integer> union = SetUtils.union(a, b);
|
||||
assertTrue(SetUtils.isEqualSet(expected, union));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenTwoSets_whenIntersection_thenIntersectionResult() {
|
||||
Set<Integer> a = new HashSet<>(Arrays.asList(1,2,5));
|
||||
Set<Integer> b = new HashSet<>(Arrays.asList(1,2));
|
||||
Set<Integer> expected = new HashSet<>(Arrays.asList(1,2));
|
||||
SetUtils.SetView<Integer> intersect = SetUtils.intersection(a, b);
|
||||
assertTrue(SetUtils.isEqualSet(expected, intersect));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenSet_whenTransformedSet_thenTransformedResult() {
|
||||
Set<Integer> a = SetUtils.transformedSet(new HashSet<>(), (e) -> e * 2 );
|
||||
a.add(2);
|
||||
assertEquals(a.toArray()[0], 4);
|
||||
|
||||
Set<Integer> source = new HashSet<>(Arrays.asList(1));
|
||||
Set<Integer> newSet = TransformedSet.transformedSet(source, (e) -> e * 2);
|
||||
assertEquals(newSet.toArray()[0], 2);
|
||||
assertEquals(source.toArray()[0], 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenTwoSet_whenDisjunction_thenDisjunctionSet() {
|
||||
Set<Integer> a = new HashSet<>(Arrays.asList(1,2,5));
|
||||
Set<Integer> b = new HashSet<>(Arrays.asList(1,2,3));
|
||||
SetUtils.SetView<Integer> result = SetUtils.disjunction(a, b);
|
||||
assertTrue(result.toSet().contains(5) && result.toSet().contains(3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenSet_when_OrderedSet_thenMaintainElementOrder() {
|
||||
Set<Integer> set = new HashSet<>(Arrays.asList(10,1,5));
|
||||
System.out.println("unordered set: " + set);
|
||||
|
||||
Set<Integer> orderedSet = SetUtils.orderedSet(new HashSet<>());
|
||||
orderedSet.addAll(Arrays.asList(10,1,5));
|
||||
System.out.println("ordered set = " + orderedSet);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,10 @@
|
|||
package com.baeldung.commons.collections.orderedmap;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections4.OrderedMap;
|
||||
import org.apache.commons.collections4.OrderedMapIterator;
|
||||
import org.apache.commons.collections4.map.LinkedMap;
|
||||
|
@ -7,11 +12,6 @@ import org.apache.commons.collections4.map.ListOrderedMap;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class OrderedMapUnitTest {
|
||||
|
||||
private String[] names = {"Emily", "Mathew", "Rose", "John", "Anna"};
|
||||
|
@ -45,11 +45,12 @@ public class OrderedMapUnitTest {
|
|||
// as defined in the constant arrays of names and ages:
|
||||
|
||||
OrderedMapIterator<String, Integer> runnersIterator = this.runnersLinkedMap.mapIterator();
|
||||
for (int i = 0; runnersIterator.hasNext(); i++) {
|
||||
int i = 0;
|
||||
while (runnersIterator.hasNext()) {
|
||||
runnersIterator.next();
|
||||
|
||||
assertEquals(runnersIterator.getKey(), this.names[i]);
|
||||
assertEquals(runnersIterator.getValue(), this.ages[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,11 +60,12 @@ public class OrderedMapUnitTest {
|
|||
// as defined in the constant arrays of names and ages:
|
||||
|
||||
OrderedMapIterator<String, Integer> runnersIterator = this.runnersListOrderedMap.mapIterator();
|
||||
for (int i = 0; runnersIterator.hasNext(); i++) {
|
||||
int i = 0;
|
||||
while (runnersIterator.hasNext()) {
|
||||
runnersIterator.next();
|
||||
|
||||
assertEquals(runnersIterator.getKey(), this.names[i]);
|
||||
assertEquals(runnersIterator.getValue(), this.ages[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,9 +75,11 @@ public class OrderedMapUnitTest {
|
|||
// as defined in the constant arrays of names and ages
|
||||
|
||||
String name = this.runnersLinkedMap.firstKey();
|
||||
for (int i = 0; name != null; i++) {
|
||||
int i = 0;
|
||||
while (name != null) {
|
||||
assertEquals(name, this.names[i]);
|
||||
name = this.runnersLinkedMap.nextKey(name);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,9 +89,11 @@ public class OrderedMapUnitTest {
|
|||
// as defined in the constant arrays of names and ages
|
||||
|
||||
String name = this.runnersListOrderedMap.firstKey();
|
||||
for (int i = 0; name != null; i++) {
|
||||
int i = 0;
|
||||
while (name != null) {
|
||||
assertEquals(name, this.names[i]);
|
||||
name = this.runnersListOrderedMap.nextKey(name);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,9 +103,11 @@ public class OrderedMapUnitTest {
|
|||
// as defined in the constant arrays of names and ages
|
||||
|
||||
String name = this.runnersLinkedMap.lastKey();
|
||||
for (int i = RUNNERS_COUNT - 1; name != null; i--) {
|
||||
int i = RUNNERS_COUNT - 1;
|
||||
while (name != null) {
|
||||
assertEquals(name, this.names[i]);
|
||||
name = this.runnersLinkedMap.previousKey(name);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,9 +117,11 @@ public class OrderedMapUnitTest {
|
|||
// as defined in the constant arrays of names and ages
|
||||
|
||||
String name = this.runnersListOrderedMap.lastKey();
|
||||
for (int i = RUNNERS_COUNT - 1; name != null; i--) {
|
||||
int i = RUNNERS_COUNT - 1;
|
||||
while (name != null) {
|
||||
assertEquals(name, this.names[i]);
|
||||
name = this.runnersListOrderedMap.previousKey(name);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,23 +14,21 @@ import org.springframework.test.context.ContextConfiguration;
|
|||
import static com.baeldung.serenity.spring.RandomNumberUtil.randomInt;
|
||||
import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_CLASS;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
AdderClassDirtiesContextIntegrationTest.DirtiesContextTest.class, AdderClassDirtiesContextIntegrationTest.AnotherDirtiesContextTest.class
|
||||
})
|
||||
AdderClassDirtiesContextIntegrationTest.DirtiesContextTest.class, AdderClassDirtiesContextIntegrationTest.AnotherDirtiesContextTest.class
|
||||
})
|
||||
public class AdderClassDirtiesContextIntegrationTest {
|
||||
|
||||
@RunWith(SerenityRunner.class)
|
||||
@ContextConfiguration(classes = AdderService.class)
|
||||
public static abstract class Base {
|
||||
|
||||
@Steps AdderServiceSteps adderServiceSteps;
|
||||
@Steps
|
||||
AdderServiceSteps adderServiceSteps;
|
||||
|
||||
@ClassRule public static SpringIntegrationClassRule springIntegrationClassRule = new SpringIntegrationClassRule();
|
||||
@ClassRule
|
||||
public static SpringIntegrationClassRule springIntegrationClassRule = new SpringIntegrationClassRule();
|
||||
|
||||
void whenAccumulate_thenSummedUp() {
|
||||
adderServiceSteps.whenAccumulate();
|
||||
|
|
|
@ -6,13 +6,11 @@ import org.jbehave.core.annotations.BeforeStory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
@ContextConfiguration(classes = { AdderController.class, AdderService.class })
|
||||
@ContextConfiguration(classes = {AdderController.class, AdderService.class})
|
||||
public class AdderTest extends SerenityStory {
|
||||
|
||||
@Autowired private AdderService adderService;
|
||||
@Autowired
|
||||
private AdderService adderService;
|
||||
|
||||
@BeforeStory
|
||||
public void init() {
|
||||
|
|
|
@ -5,10 +5,10 @@ import com.netflix.servo.stats.StatsConfig;
|
|||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
@ -123,15 +123,14 @@ public class MetricTypeTest {
|
|||
.getTotalTime()
|
||||
.intValue());
|
||||
|
||||
final Map<String, Long> metricMap = new HashMap<>(3);
|
||||
timer
|
||||
final Map<String, Long> metricMap = timer
|
||||
.getMonitors()
|
||||
.stream()
|
||||
.filter(monitor -> monitor
|
||||
.getConfig()
|
||||
.getTags()
|
||||
.containsKey("servo.bucket"))
|
||||
.forEach(monitor -> metricMap.put(getMonitorTagValue(monitor, "servo.bucket"), (Long) monitor.getValue()));
|
||||
.collect(toMap(monior -> getMonitorTagValue(monior, "servo.bucket"), monitor -> (Long) monitor.getValue()));
|
||||
|
||||
assertThat(metricMap, allOf(hasEntry("bucket=2s", 0L), hasEntry("bucket=5s", 1L), hasEntry("bucket=overflow", 1L)));
|
||||
}
|
||||
|
@ -177,10 +176,10 @@ public class MetricTypeTest {
|
|||
.getValue()
|
||||
.intValue());
|
||||
|
||||
final Map<String, Number> metricMap = new HashMap<>(10);
|
||||
timer
|
||||
final Map<String, Number> metricMap = timer
|
||||
.getMonitors()
|
||||
.forEach(monitor -> metricMap.put(getMonitorTagValue(monitor, "statistic"), (Number) monitor.getValue()));
|
||||
.stream()
|
||||
.collect(toMap(monitor -> getMonitorTagValue(monitor, "statistic"), monitor -> (Number) monitor.getValue()));
|
||||
|
||||
assertThat(metricMap.keySet(), containsInAnyOrder("count", "totalTime", "max", "min", "variance", "stdDev", "avg", "percentile_99", "percentile_95", "percentile_90"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue