mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-17 22:59:43 +00:00
deps: Refactor dependencies (#3224)
* remove spring dep move junit, logging, mockito under dep mgmt * upgrade anti-corruption-layer deps * async method invocation * balking, bloc * bridge to bytecode * caching * callback - cqrs * component - health check * hexagonal - metadata mapping * rest of the patterns * remove checkstyle, take spotless into use
This commit is contained in:
@@ -24,24 +24,21 @@
|
||||
*/
|
||||
package com.iluwatar;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class MapReduceTest {
|
||||
|
||||
@Test
|
||||
void testMapReduce() {
|
||||
List<String> inputs = Arrays.asList(
|
||||
"Hello world hello",
|
||||
"MapReduce is fun",
|
||||
"Hello from the other side"
|
||||
);
|
||||
List<String> inputs =
|
||||
Arrays.asList("Hello world hello", "MapReduce is fun", "Hello from the other side");
|
||||
|
||||
List<Map.Entry<String, Integer>> result = MapReduce.mapReduce(inputs);
|
||||
|
||||
assertEquals("hello", result.get(0).getKey()); // hello = 3
|
||||
assertEquals("hello", result.get(0).getKey()); // hello = 3
|
||||
assertEquals(3, result.get(0).getValue());
|
||||
assertEquals(1, result.get(1).getValue());
|
||||
}
|
||||
|
||||
@@ -24,10 +24,11 @@
|
||||
*/
|
||||
package com.iluwatar;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.util.Map;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.Map;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class MapperTest {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
*/
|
||||
package com.iluwatar;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class ReducerTest {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -24,19 +24,17 @@
|
||||
*/
|
||||
package com.iluwatar;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class ShufflerTest {
|
||||
|
||||
@Test
|
||||
void testShuffleAndSort() {
|
||||
List<Map<String, Integer>> mappedData = Arrays.asList(
|
||||
Map.of("hello", 1, "world", 2),
|
||||
Map.of("hello", 2, "java", 1)
|
||||
);
|
||||
List<Map<String, Integer>> mappedData =
|
||||
Arrays.asList(Map.of("hello", 1, "world", 2), Map.of("hello", 2, "java", 1));
|
||||
|
||||
Map<String, List<Integer>> grouped = Shuffler.shuffleAndSort(mappedData);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user