Skip to content

Commit 201d616

Browse files
author
Eugen Paraschiv
committed
minor cleanup
1 parent 5deb531 commit 201d616

File tree

4 files changed

+23
-36
lines changed

4 files changed

+23
-36
lines changed

core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,22 @@
55
*/
66
package com.baeldung.nullsafecollectionstreams;
77

8+
import static org.junit.Assert.assertEquals;
9+
810
import java.util.Arrays;
911
import java.util.Collection;
1012
import java.util.Iterator;
1113
import java.util.stream.Stream;
12-
import org.junit.After;
13-
import org.junit.AfterClass;
14-
import org.junit.Before;
15-
import org.junit.BeforeClass;
14+
1615
import org.junit.Test;
17-
import static org.junit.Assert.*;
1816

1917
/**
2018
*
2119
* @author Kwaje Anthony <kwajeanthony@gmail.com>
2220
*/
2321
public class NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest {
24-
25-
private final NullSafeCollectionStreamsUsingJava8OptionalContainer instance =
26-
new NullSafeCollectionStreamsUsingJava8OptionalContainer();
22+
23+
private final NullSafeCollectionStreamsUsingJava8OptionalContainer instance = new NullSafeCollectionStreamsUsingJava8OptionalContainer();
2724

2825
@Test
2926
public void whenCollectionIsNull_thenExpectAnEmptyStream() {
@@ -49,5 +46,5 @@ private static void assertStreamEquals(Stream<?> s1, Stream<?> s2) {
4946
assertEquals(iter1.next(), iter2.next());
5047
assert !iter1.hasNext() && !iter2.hasNext();
5148
}
52-
49+
5350
}

core-java-8/src/test/java/com/baeldung/util/CurrentDateTimeUnitTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.baeldung.util;
22

33
import static org.junit.Assert.assertEquals;
4-
import static org.junit.Assert.assertTrue;
54

65
import java.time.Clock;
76
import java.time.Instant;
@@ -10,8 +9,6 @@
109
import java.time.ZoneId;
1110
import java.time.temporal.ChronoField;
1211

13-
import org.joda.time.DateTime;
14-
import org.joda.time.DateTimeUtils;
1512
import org.junit.Test;
1613

1714
public class CurrentDateTimeUnitTest {

java-streams/pom.xml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
4-
<groupId>com.baeldung</groupId>
54
<artifactId>java-streams</artifactId>
65
<version>0.1.0-SNAPSHOT</version>
76
<packaging>jar</packaging>
@@ -15,17 +14,17 @@
1514
</parent>
1615

1716
<dependencies>
18-
<!-- https://mvnrepository.com/artifact/org.openjdk.jmh/jmh-core -->
19-
<dependency>
20-
<groupId>org.openjdk.jmh</groupId>
21-
<artifactId>jmh-core</artifactId>
22-
<version>${jmh.version}</version>
23-
</dependency>
24-
<dependency>
25-
<groupId>org.openjdk.jmh</groupId>
26-
<artifactId>jmh-generator-annprocess</artifactId>
27-
<version>${jmh.version}</version>
28-
<scope>provided</scope>
17+
<!-- https://mvnrepository.com/artifact/org.openjdk.jmh/jmh-core -->
18+
<dependency>
19+
<groupId>org.openjdk.jmh</groupId>
20+
<artifactId>jmh-core</artifactId>
21+
<version>${jmh.version}</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.openjdk.jmh</groupId>
25+
<artifactId>jmh-generator-annprocess</artifactId>
26+
<version>${jmh.version}</version>
27+
<scope>provided</scope>
2928
</dependency>
3029
<dependency>
3130
<groupId>org.apache.commons</groupId>

java-streams/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
package com.baeldung.stream;
22

3-
import org.junit.Test;
3+
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertTrue;
45

5-
import java.util.Arrays;
66
import java.util.List;
77
import java.util.stream.Collectors;
88
import java.util.stream.IntStream;
99
import java.util.stream.Stream;
1010

11-
import static org.junit.Assert.assertEquals;
12-
import static org.junit.Assert.assertTrue;
11+
import org.junit.Test;
1312

1413
public class PrimitiveStreamsUnitTest {
1514

1615
private PrimitiveStreams streams = new PrimitiveStreams();
1716

1817
@Test
1918
public void givenAnArrayOfIntegersWhenMinIsCalledThenCorrectMinIsReturned() {
20-
int[] integers = new int[] {20, 98, 12, 7, 35};
19+
int[] integers = new int[] { 20, 98, 12, 7, 35 };
2120
int min = streams.min(integers); // returns 7
2221

2322
assertEquals(7, min);
@@ -66,19 +65,14 @@ public void givenARangeWhenForEachIsCalledThenTheIndicesWillBePrinted() {
6665
@Test
6766
public void givenAnArrayWhenSumIsCalledThenTheCorrectSumIsReturned() {
6867

69-
int sum = Stream.of(33,45)
70-
.mapToInt(i -> i)
71-
.sum();
68+
int sum = Stream.of(33, 45).mapToInt(i -> i).sum();
7269

7370
assertEquals(78, sum);
7471
}
7572

7673
@Test
7774
public void givenAnIntStreamThenGetTheEvenIntegers() {
78-
List<Integer> evenInts = IntStream.rangeClosed(1, 10)
79-
.filter(i -> i % 2 == 0)
80-
.boxed()
81-
.collect(Collectors.toList());
75+
List<Integer> evenInts = IntStream.rangeClosed(1, 10).filter(i -> i % 2 == 0).boxed().collect(Collectors.toList());
8276

8377
List<Integer> expected = IntStream.of(2, 4, 6, 8, 10).boxed().collect(Collectors.toList());
8478

0 commit comments

Comments
 (0)