junit cleanup and upgrade
This commit is contained in:
parent
8c4bc9b539
commit
2d4ee75653
@ -32,6 +32,5 @@
|
|||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<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">
|
<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">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.baeldung</groupId>
|
<groupId>org.baeldung</groupId>
|
||||||
<artifactId>spring-rest</artifactId>
|
<artifactId>spring-rest</artifactId>
|
||||||
@ -34,31 +35,8 @@
|
|||||||
<version>3.3.2</version>
|
<version>3.3.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- web -->
|
|
||||||
|
|
||||||
<!-- marshalling -->
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
<version>${jackson.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- test scoped -->
|
<!-- test scoped -->
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit-dep</artifactId>
|
|
||||||
<version>${junit.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.hamcrest</groupId>
|
|
||||||
<artifactId>hamcrest-core</artifactId>
|
|
||||||
<version>${org.hamcrest.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hamcrest</groupId>
|
<groupId>org.hamcrest</groupId>
|
||||||
<artifactId>hamcrest-library</artifactId>
|
<artifactId>hamcrest-library</artifactId>
|
||||||
@ -66,6 +44,13 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
@ -107,23 +92,12 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Spring -->
|
|
||||||
<org.springframework.version>4.0.0.RELEASE</org.springframework.version>
|
|
||||||
<org.springframework.security.version>3.2.0.RELEASE</org.springframework.security.version>
|
|
||||||
|
|
||||||
<!-- persistence -->
|
|
||||||
<hibernate.version>4.3.0.Final</hibernate.version>
|
|
||||||
<mysql-connector-java.version>5.1.27</mysql-connector-java.version>
|
|
||||||
|
|
||||||
<!-- marshalling -->
|
|
||||||
<jackson.version>2.4.0</jackson.version>
|
|
||||||
|
|
||||||
<!-- logging -->
|
<!-- logging -->
|
||||||
<org.slf4j.version>1.7.5</org.slf4j.version>
|
<org.slf4j.version>1.7.5</org.slf4j.version>
|
||||||
<logback.version>1.0.11</logback.version>
|
<logback.version>1.0.11</logback.version>
|
||||||
|
|
||||||
<!-- various -->
|
<!-- various -->
|
||||||
<hibernate-validator.version>5.1.1.Final</hibernate-validator.version>
|
<hibernate-validator.version>5.1.3.Final</hibernate-validator.version>
|
||||||
|
|
||||||
<!-- util -->
|
<!-- util -->
|
||||||
<guava.version>18.0</guava.version>
|
<guava.version>18.0</guava.version>
|
||||||
@ -131,18 +105,13 @@
|
|||||||
|
|
||||||
<!-- testing -->
|
<!-- testing -->
|
||||||
<org.hamcrest.version>1.3</org.hamcrest.version>
|
<org.hamcrest.version>1.3</org.hamcrest.version>
|
||||||
<junit.version>4.11</junit.version>
|
<junit.version>4.12</junit.version>
|
||||||
<mockito.version>1.10.8</mockito.version>
|
<mockito.version>1.10.19</mockito.version>
|
||||||
|
|
||||||
<httpcore.version>4.3.3</httpcore.version>
|
|
||||||
<httpclient.version>4.3.4</httpclient.version>
|
|
||||||
|
|
||||||
<rest-assured.version>2.3.2</rest-assured.version>
|
|
||||||
|
|
||||||
<!-- maven plugins -->
|
<!-- maven plugins -->
|
||||||
<maven-compiler-plugin.version>3.2</maven-compiler-plugin.version>
|
<maven-compiler-plugin.version>3.2</maven-compiler-plugin.version>
|
||||||
<maven-war-plugin.version>2.5</maven-war-plugin.version>
|
<maven-war-plugin.version>2.5</maven-war-plugin.version>
|
||||||
<maven-surefire-plugin.version>2.17</maven-surefire-plugin.version>
|
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
|
||||||
<maven-resources-plugin.version>2.7</maven-resources-plugin.version>
|
<maven-resources-plugin.version>2.7</maven-resources-plugin.version>
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -20,26 +20,32 @@ public class Java8SortUnitTest {
|
|||||||
@Test
|
@Test
|
||||||
public final void givenPreLambda_whenSortingEntitiesByName_thenCorrectlySorted() {
|
public final void givenPreLambda_whenSortingEntitiesByName_thenCorrectlySorted() {
|
||||||
final List<Human> humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
|
final List<Human> humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
|
||||||
|
|
||||||
Collections.sort(humans, new Comparator<Human>() {
|
Collections.sort(humans, new Comparator<Human>() {
|
||||||
@Override
|
@Override
|
||||||
public final int compare(final Human h1, final Human h2) {
|
public final int compare(final Human h1, final Human h2) {
|
||||||
return h1.getName().compareTo(h2.getName());
|
return h1.getName().compareTo(h2.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
|
Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public final void whenSortingEntitiesByName_thenCorrectlySorted() {
|
public final void whenSortingEntitiesByName_thenCorrectlySorted() {
|
||||||
final List<Human> humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
|
final List<Human> humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
|
||||||
|
|
||||||
Collections.sort(humans, (final Human h1, final Human h2) -> h1.getName().compareTo(h2.getName()));
|
Collections.sort(humans, (final Human h1, final Human h2) -> h1.getName().compareTo(h2.getName()));
|
||||||
|
|
||||||
Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
|
Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public final void givenLambdaShortForm_whenSortingEntitiesByName_thenCorrectlySorted() {
|
public final void givenLambdaShortForm_whenSortingEntitiesByName_thenCorrectlySorted() {
|
||||||
final List<Human> humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
|
final List<Human> humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
|
||||||
Collections.sort(humans, (h1, h2) -> h1.getName().compareTo(h2.getName()));
|
|
||||||
|
humans.sort((h1, h2) -> h1.getName().compareTo(h2.getName()));
|
||||||
|
|
||||||
Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
|
Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user