Skip to content

Commit 2d4ee75

Browse files
author
eugenp
committed
junit cleanup and upgrade
1 parent 8c4bc9b commit 2d4ee75

3 files changed

Lines changed: 19 additions & 45 deletions

File tree

core-java-8/.classpath

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,5 @@
3232
<attribute name="maven.pomderived" value="true"/>
3333
</attributes>
3434
</classpathentry>
35-
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
3635
<classpathentry kind="output" path="target/classes"/>
3736
</classpath>

core-java-8/pom.xml

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<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">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23
<modelVersion>4.0.0</modelVersion>
34
<groupId>org.baeldung</groupId>
45
<artifactId>spring-rest</artifactId>
@@ -34,35 +35,19 @@
3435
<version>3.3.2</version>
3536
</dependency>
3637

37-
<!-- web -->
38-
39-
<!-- marshalling -->
40-
41-
<dependency>
42-
<groupId>com.fasterxml.jackson.core</groupId>
43-
<artifactId>jackson-databind</artifactId>
44-
<version>${jackson.version}</version>
45-
</dependency>
46-
4738
<!-- test scoped -->
48-
49-
<dependency>
50-
<groupId>junit</groupId>
51-
<artifactId>junit-dep</artifactId>
52-
<version>${junit.version}</version>
53-
<scope>test</scope>
54-
</dependency>
55-
39+
5640
<dependency>
5741
<groupId>org.hamcrest</groupId>
58-
<artifactId>hamcrest-core</artifactId>
42+
<artifactId>hamcrest-library</artifactId>
5943
<version>${org.hamcrest.version}</version>
6044
<scope>test</scope>
6145
</dependency>
46+
6247
<dependency>
63-
<groupId>org.hamcrest</groupId>
64-
<artifactId>hamcrest-library</artifactId>
65-
<version>${org.hamcrest.version}</version>
48+
<groupId>junit</groupId>
49+
<artifactId>junit</artifactId>
50+
<version>${junit.version}</version>
6651
<scope>test</scope>
6752
</dependency>
6853

@@ -107,42 +92,26 @@
10792
</build>
10893

10994
<properties>
110-
<!-- Spring -->
111-
<org.springframework.version>4.0.0.RELEASE</org.springframework.version>
112-
<org.springframework.security.version>3.2.0.RELEASE</org.springframework.security.version>
113-
114-
<!-- persistence -->
115-
<hibernate.version>4.3.0.Final</hibernate.version>
116-
<mysql-connector-java.version>5.1.27</mysql-connector-java.version>
117-
118-
<!-- marshalling -->
119-
<jackson.version>2.4.0</jackson.version>
120-
12195
<!-- logging -->
12296
<org.slf4j.version>1.7.5</org.slf4j.version>
12397
<logback.version>1.0.11</logback.version>
12498

12599
<!-- various -->
126-
<hibernate-validator.version>5.1.1.Final</hibernate-validator.version>
100+
<hibernate-validator.version>5.1.3.Final</hibernate-validator.version>
127101

128102
<!-- util -->
129103
<guava.version>18.0</guava.version>
130104
<commons-lang3.version>3.3.2</commons-lang3.version>
131105

132106
<!-- testing -->
133107
<org.hamcrest.version>1.3</org.hamcrest.version>
134-
<junit.version>4.11</junit.version>
135-
<mockito.version>1.10.8</mockito.version>
136-
137-
<httpcore.version>4.3.3</httpcore.version>
138-
<httpclient.version>4.3.4</httpclient.version>
139-
140-
<rest-assured.version>2.3.2</rest-assured.version>
108+
<junit.version>4.12</junit.version>
109+
<mockito.version>1.10.19</mockito.version>
141110

142111
<!-- maven plugins -->
143112
<maven-compiler-plugin.version>3.2</maven-compiler-plugin.version>
144113
<maven-war-plugin.version>2.5</maven-war-plugin.version>
145-
<maven-surefire-plugin.version>2.17</maven-surefire-plugin.version>
114+
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
146115
<maven-resources-plugin.version>2.7</maven-resources-plugin.version>
147116

148117
</properties>

core-java-8/src/test/java/org/baeldung/java8/Java8SortUnitTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,32 @@ public class Java8SortUnitTest {
2020
@Test
2121
public final void givenPreLambda_whenSortingEntitiesByName_thenCorrectlySorted() {
2222
final List<Human> humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
23+
2324
Collections.sort(humans, new Comparator<Human>() {
2425
@Override
2526
public final int compare(final Human h1, final Human h2) {
2627
return h1.getName().compareTo(h2.getName());
2728
}
2829
});
30+
2931
Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
3032
}
3133

3234
@Test
3335
public final void whenSortingEntitiesByName_thenCorrectlySorted() {
3436
final List<Human> humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
37+
3538
Collections.sort(humans, (final Human h1, final Human h2) -> h1.getName().compareTo(h2.getName()));
39+
3640
Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
3741
}
3842

3943
@Test
4044
public final void givenLambdaShortForm_whenSortingEntitiesByName_thenCorrectlySorted() {
4145
final List<Human> humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
42-
Collections.sort(humans, (h1, h2) -> h1.getName().compareTo(h2.getName()));
46+
47+
humans.sort((h1, h2) -> h1.getName().compareTo(h2.getName()));
48+
4349
Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
4450
}
4551

0 commit comments

Comments
 (0)