Skip to content

Commit 0ca162a

Browse files
authored
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
1 parent 371439a commit 0ca162a

File tree

1,863 files changed

+14487
-17716
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,863 files changed

+14487
-17716
lines changed

Diff for: abstract-document/pom.xml

+8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
</parent>
3535
<artifactId>abstract-document</artifactId>
3636
<dependencies>
37+
<dependency>
38+
<groupId>org.slf4j</groupId>
39+
<artifactId>slf4j-api</artifactId>
40+
</dependency>
41+
<dependency>
42+
<groupId>ch.qos.logback</groupId>
43+
<artifactId>logback-classic</artifactId>
44+
</dependency>
3745
<dependency>
3846
<groupId>org.junit.jupiter</groupId>
3947
<artifactId>junit-jupiter-engine</artifactId>

Diff for: abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java

+7-10
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131
import java.util.function.Function;
3232
import java.util.stream.Stream;
3333

34-
/**
35-
* Abstract implementation of Document interface.
36-
*/
34+
/** Abstract implementation of Document interface. */
3735
public abstract class AbstractDocument implements Document {
3836

3937
private final Map<String, Object> documentProperties;
@@ -57,12 +55,12 @@ public Object get(String key) {
5755
@Override
5856
public <T> Stream<T> children(String key, Function<Map<String, Object>, T> childConstructor) {
5957
return Stream.ofNullable(get(key))
60-
.filter(Objects::nonNull)
61-
.map(el -> (List<Map<String, Object>>) el)
62-
.findAny()
63-
.stream()
64-
.flatMap(Collection::stream)
65-
.map(childConstructor);
58+
.filter(Objects::nonNull)
59+
.map(el -> (List<Map<String, Object>>) el)
60+
.findAny()
61+
.stream()
62+
.flatMap(Collection::stream)
63+
.map(childConstructor);
6664
}
6765

6866
@Override
@@ -100,5 +98,4 @@ private String buildStringRepresentation() {
10098
builder.append("]");
10199
return builder.toString();
102100
}
103-
104101
}

Diff for: abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java

+26-17
Original file line numberDiff line numberDiff line change
@@ -49,31 +49,40 @@ public class App {
4949
public static void main(String[] args) {
5050
LOGGER.info("Constructing parts and car");
5151

52-
var wheelProperties = Map.of(
53-
Property.TYPE.toString(), "wheel",
54-
Property.MODEL.toString(), "15C",
55-
Property.PRICE.toString(), 100L);
52+
var wheelProperties =
53+
Map.of(
54+
Property.TYPE.toString(), "wheel",
55+
Property.MODEL.toString(), "15C",
56+
Property.PRICE.toString(), 100L);
5657

57-
var doorProperties = Map.of(
58-
Property.TYPE.toString(), "door",
59-
Property.MODEL.toString(), "Lambo",
60-
Property.PRICE.toString(), 300L);
58+
var doorProperties =
59+
Map.of(
60+
Property.TYPE.toString(), "door",
61+
Property.MODEL.toString(), "Lambo",
62+
Property.PRICE.toString(), 300L);
6163

62-
var carProperties = Map.of(
63-
Property.MODEL.toString(), "300SL",
64-
Property.PRICE.toString(), 10000L,
65-
Property.PARTS.toString(), List.of(wheelProperties, doorProperties));
64+
var carProperties =
65+
Map.of(
66+
Property.MODEL.toString(),
67+
"300SL",
68+
Property.PRICE.toString(),
69+
10000L,
70+
Property.PARTS.toString(),
71+
List.of(wheelProperties, doorProperties));
6672

6773
var car = new Car(carProperties);
6874

6975
LOGGER.info("Here is our car:");
7076
LOGGER.info("-> model: {}", car.getModel().orElseThrow());
7177
LOGGER.info("-> price: {}", car.getPrice().orElseThrow());
7278
LOGGER.info("-> parts: ");
73-
car.getParts().forEach(p -> LOGGER.info("\t{}/{}/{}",
74-
p.getType().orElse(null),
75-
p.getModel().orElse(null),
76-
p.getPrice().orElse(null))
77-
);
79+
car.getParts()
80+
.forEach(
81+
p ->
82+
LOGGER.info(
83+
"\t{}/{}/{}",
84+
p.getType().orElse(null),
85+
p.getModel().orElse(null),
86+
p.getPrice().orElse(null)));
7887
}
7988
}

Diff for: abstract-document/src/main/java/com/iluwatar/abstractdocument/Document.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@
2828
import java.util.function.Function;
2929
import java.util.stream.Stream;
3030

31-
/**
32-
* Document interface.
33-
*/
31+
/** Document interface. */
3432
public interface Document {
3533

3634
/**
3735
* Puts the value related to the key.
3836
*
39-
* @param key element key
37+
* @param key element key
4038
* @param value element value
4139
* @return Void
4240
*/
@@ -53,7 +51,7 @@ public interface Document {
5351
/**
5452
* Gets the stream of child documents.
5553
*
56-
* @param key element key
54+
* @param key element key
5755
* @param constructor constructor of child class
5856
* @return child documents
5957
*/

Diff for: abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/Car.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@
2727
import com.iluwatar.abstractdocument.AbstractDocument;
2828
import java.util.Map;
2929

30-
/**
31-
* Car entity.
32-
*/
30+
/** Car entity. */
3331
public class Car extends AbstractDocument implements HasModel, HasPrice, HasParts {
3432

3533
public Car(Map<String, Object> properties) {
3634
super(properties);
3735
}
38-
3936
}

Diff for: abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasModel.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@
2828
import com.iluwatar.abstractdocument.domain.enums.Property;
2929
import java.util.Optional;
3030

31-
/**
32-
* HasModel trait for static access to 'model' property.
33-
*/
31+
/** HasModel trait for static access to 'model' property. */
3432
public interface HasModel extends Document {
3533

3634
default Optional<String> getModel() {
3735
return Optional.ofNullable((String) get(Property.MODEL.toString()));
3836
}
39-
4037
}

Diff for: abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasParts.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@
2828
import com.iluwatar.abstractdocument.domain.enums.Property;
2929
import java.util.stream.Stream;
3030

31-
/**
32-
* HasParts trait for static access to 'parts' property.
33-
*/
31+
/** HasParts trait for static access to 'parts' property. */
3432
public interface HasParts extends Document {
3533

3634
default Stream<Part> getParts() {
3735
return children(Property.PARTS.toString(), Part::new);
3836
}
39-
4037
}

Diff for: abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasPrice.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@
2828
import com.iluwatar.abstractdocument.domain.enums.Property;
2929
import java.util.Optional;
3030

31-
/**
32-
* HasPrice trait for static access to 'price' property.
33-
*/
31+
/** HasPrice trait for static access to 'price' property. */
3432
public interface HasPrice extends Document {
3533

3634
default Optional<Number> getPrice() {
3735
return Optional.ofNullable((Number) get(Property.PRICE.toString()));
3836
}
39-
4037
}

Diff for: abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasType.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@
2828
import com.iluwatar.abstractdocument.domain.enums.Property;
2929
import java.util.Optional;
3030

31-
/**
32-
* HasType trait for static access to 'type' property.
33-
*/
31+
/** HasType trait for static access to 'type' property. */
3432
public interface HasType extends Document {
3533

3634
default Optional<String> getType() {
3735
return Optional.ofNullable((String) get(Property.TYPE.toString()));
3836
}
39-
4037
}

Diff for: abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/Part.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@
2727
import com.iluwatar.abstractdocument.AbstractDocument;
2828
import java.util.Map;
2929

30-
/**
31-
* Part entity.
32-
*/
30+
/** Part entity. */
3331
public class Part extends AbstractDocument implements HasType, HasModel, HasPrice {
3432

3533
public Part(Map<String, Object> properties) {
3634
super(properties);
3735
}
38-
3936
}

Diff for: abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/enums/Property.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
*/
2525
package com.iluwatar.abstractdocument.domain.enums;
2626

27-
/**
28-
* Enum To Describe Property type.
29-
*/
27+
/** Enum To Describe Property type. */
3028
public enum Property {
31-
32-
PARTS, TYPE, PRICE, MODEL
29+
PARTS,
30+
TYPE,
31+
PRICE,
32+
MODEL
3333
}

Diff for: abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java

+14-13
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,14 @@
2424
*/
2525
package com.iluwatar.abstractdocument;
2626

27-
import org.junit.jupiter.api.Test;
27+
import static org.junit.jupiter.api.Assertions.*;
28+
2829
import java.util.HashMap;
2930
import java.util.List;
3031
import java.util.Map;
32+
import org.junit.jupiter.api.Test;
3133

32-
import static org.junit.jupiter.api.Assertions.*;
33-
34-
/**
35-
* AbstractDocument test class
36-
*/
34+
/** AbstractDocument test class */
3735
class AbstractDocumentTest {
3836

3937
private static final String KEY = "key";
@@ -82,13 +80,16 @@ void shouldIncludePropsInToString() {
8280

8381
@Test
8482
void shouldHandleExceptionDuringConstruction() {
85-
Map<String, Object> invalidProperties = null; // Invalid properties, causing NullPointerException
83+
Map<String, Object> invalidProperties =
84+
null; // Invalid properties, causing NullPointerException
8685

8786
// Throw null pointer exception
88-
assertThrows(NullPointerException.class, () -> {
89-
// Attempt to construct a document with invalid properties
90-
new DocumentImplementation(invalidProperties);
91-
});
87+
assertThrows(
88+
NullPointerException.class,
89+
() -> {
90+
// Attempt to construct a document with invalid properties
91+
new DocumentImplementation(invalidProperties);
92+
});
9293
}
9394

9495
@Test
@@ -97,11 +98,11 @@ void shouldPutAndGetNestedDocument() {
9798
DocumentImplementation nestedDocument = new DocumentImplementation(new HashMap<>());
9899
nestedDocument.put("nestedKey", "nestedValue");
99100

100-
101101
document.put("nested", nestedDocument);
102102

103103
// Retrieving the nested document
104-
DocumentImplementation retrievedNestedDocument = (DocumentImplementation) document.get("nested");
104+
DocumentImplementation retrievedNestedDocument =
105+
(DocumentImplementation) document.get("nested");
105106

106107
assertNotNull(retrievedNestedDocument);
107108
assertEquals("nestedValue", retrievedNestedDocument.get("nestedKey"));

Diff for: abstract-document/src/test/java/com/iluwatar/abstractdocument/AppTest.java

+5-9
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,21 @@
2424
*/
2525
package com.iluwatar.abstractdocument;
2626

27-
import org.junit.jupiter.api.Test;
28-
2927
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
3028

31-
/**
32-
* Simple App test
33-
*/
29+
import org.junit.jupiter.api.Test;
30+
31+
/** Simple App test */
3432
class AppTest {
3533

3634
/**
3735
* Issue: Add at least one assertion to this test case.
3836
*
39-
* Solution: Inserted assertion to check whether the execution of the main method in {@link App}
40-
* throws an exception.
37+
* <p>Solution: Inserted assertion to check whether the execution of the main method in {@link
38+
* App} throws an exception.
4139
*/
42-
4340
@Test
4441
void shouldExecuteAppWithoutException() {
4542
assertDoesNotThrow(() -> App.main(null));
4643
}
47-
4844
}

Diff for: abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java

+14-17
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,16 @@
2424
*/
2525
package com.iluwatar.abstractdocument;
2626

27+
import static org.junit.jupiter.api.Assertions.assertEquals;
28+
2729
import com.iluwatar.abstractdocument.domain.Car;
2830
import com.iluwatar.abstractdocument.domain.Part;
2931
import com.iluwatar.abstractdocument.domain.enums.Property;
30-
import org.junit.jupiter.api.Test;
3132
import java.util.List;
3233
import java.util.Map;
34+
import org.junit.jupiter.api.Test;
3335

34-
import static org.junit.jupiter.api.Assertions.assertEquals;
35-
36-
/**
37-
* Test for Part and Car
38-
*/
36+
/** Test for Part and Car */
3937
class DomainTest {
4038

4139
private static final String TEST_PART_TYPE = "test-part-type";
@@ -47,11 +45,11 @@ class DomainTest {
4745

4846
@Test
4947
void shouldConstructPart() {
50-
var partProperties = Map.of(
51-
Property.TYPE.toString(), TEST_PART_TYPE,
52-
Property.MODEL.toString(), TEST_PART_MODEL,
53-
Property.PRICE.toString(), (Object) TEST_PART_PRICE
54-
);
48+
var partProperties =
49+
Map.of(
50+
Property.TYPE.toString(), TEST_PART_TYPE,
51+
Property.MODEL.toString(), TEST_PART_MODEL,
52+
Property.PRICE.toString(), (Object) TEST_PART_PRICE);
5553
var part = new Part(partProperties);
5654
assertEquals(TEST_PART_TYPE, part.getType().orElseThrow());
5755
assertEquals(TEST_PART_MODEL, part.getModel().orElseThrow());
@@ -60,15 +58,14 @@ void shouldConstructPart() {
6058

6159
@Test
6260
void shouldConstructCar() {
63-
var carProperties = Map.of(
64-
Property.MODEL.toString(), TEST_CAR_MODEL,
65-
Property.PRICE.toString(), TEST_CAR_PRICE,
66-
Property.PARTS.toString(), List.of(Map.of(), Map.of())
67-
);
61+
var carProperties =
62+
Map.of(
63+
Property.MODEL.toString(), TEST_CAR_MODEL,
64+
Property.PRICE.toString(), TEST_CAR_PRICE,
65+
Property.PARTS.toString(), List.of(Map.of(), Map.of()));
6866
var car = new Car(carProperties);
6967
assertEquals(TEST_CAR_MODEL, car.getModel().orElseThrow());
7068
assertEquals(TEST_CAR_PRICE, car.getPrice().orElseThrow());
7169
assertEquals(2, car.getParts().count());
7270
}
73-
7471
}

0 commit comments

Comments
 (0)