Build opt 9 08 2017 (#2397)

* pCollections

* Reformat

* Refactor metrics

* Refactor hoverfly
This commit is contained in:
Grzegorz Piwowarek
2017-08-09 15:32:08 +02:00
committed by GitHub
parent 69f3e1175a
commit b5478f7e9a
9 changed files with 72 additions and 50 deletions
@@ -23,9 +23,9 @@ public class HLLUnitTest {
//when
LongStream.range(0, numberOfElements).forEach(element -> {
long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong();
hll.addRaw(hashedValue);
}
long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong();
hll.addRaw(hashedValue);
}
);
//then
@@ -44,15 +44,15 @@ public class HLLUnitTest {
//when
LongStream.range(0, numberOfElements).forEach(element -> {
long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong();
firstHll.addRaw(hashedValue);
}
long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong();
firstHll.addRaw(hashedValue);
}
);
LongStream.range(numberOfElements, numberOfElements * 2).forEach(element -> {
long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong();
secondHLL.addRaw(hashedValue);
}
long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong();
secondHLL.addRaw(hashedValue);
}
);
//then
@@ -31,7 +31,7 @@ import org.springframework.web.client.RestTemplate;
import io.specto.hoverfly.junit.core.SimulationSource;
import io.specto.hoverfly.junit.rule.HoverflyRule;
public class HoverflyApiTest {
public class HoverflyApiIntegrationTest {
private static final SimulationSource source = dsl(
service("http://www.baeldung.com")
@@ -1,7 +1,12 @@
package com.baeldung.pcollections;
import org.junit.Test;
import org.pcollections.*;
import org.pcollections.HashPMap;
import org.pcollections.HashTreePMap;
import org.pcollections.HashTreePSet;
import org.pcollections.MapPSet;
import org.pcollections.PVector;
import org.pcollections.TreePVector;
import java.util.Arrays;
import java.util.HashMap;
@@ -27,7 +32,7 @@ public class PCollectionsUnitTest {
@Test
public void givenExistingHashMap_whenFrom_thenCreateHashPMap() {
Map map = new HashMap();
Map<String, String> map = new HashMap<>();
map.put("mkey1", "mval1");
map.put("mkey2", "mval2");
@@ -41,7 +46,7 @@ public class PCollectionsUnitTest {
HashPMap<String, String> pmap = HashTreePMap.empty();
HashPMap<String, String> pmap0 = pmap.plus("key1", "value1");
Map map = new HashMap();
Map<String, String> map = new HashMap<>();
map.put("key2", "val2");
map.put("key3", "val3");
@@ -57,22 +62,24 @@ public class PCollectionsUnitTest {
@Test
public void whenTreePVectorMethods_thenPerformOperations() {
TreePVector pVector = TreePVector.empty();
TreePVector<String> pVector = TreePVector.empty();
TreePVector<String> pV1 = pVector.plus("e1");
TreePVector<String> pV2 = pV1.plusAll(Arrays.asList("e2", "e3", "e4"));
TreePVector pV1 = pVector.plus("e1");
TreePVector pV2 = pV1.plusAll(Arrays.asList("e2", "e3", "e4"));
assertEquals(1, pV1.size());
assertEquals(4, pV2.size());
TreePVector pV3 = pV2.minus("e1");
TreePVector pV4 = pV3.minusAll(Arrays.asList("e2", "e3", "e4"));
TreePVector<String> pV3 = pV2.minus("e1");
TreePVector<String> pV4 = pV3.minusAll(Arrays.asList("e2", "e3", "e4"));
assertEquals(pV3.size(), 3);
assertEquals(pV4.size(), 0);
TreePVector pSub = pV2.subList(0, 2);
TreePVector<String> pSub = pV2.subList(0, 2);
assertTrue(pSub.contains("e1") && pSub.contains("e2"));
TreePVector pVW = (TreePVector) pV2.with(0, "e10");
PVector<String> pVW = pV2.with(0, "e10");
assertEquals(pVW.get(0), "e10");
}
@@ -80,7 +87,7 @@ public class PCollectionsUnitTest {
public void whenMapPSetMethods_thenPerformOperations() {
MapPSet pSet = HashTreePSet.empty()
.plusAll(Arrays.asList("e1","e2","e3","e4"));
.plusAll(Arrays.asList("e1", "e2", "e3", "e4"));
assertEquals(pSet.size(), 4);
MapPSet pSet1 = pSet.minus("e4");