Migrate to JUnit5

This commit is contained in:
Artur Mogozov
2017-12-31 16:29:48 +09:00
parent a20e54d0a7
commit 6694d742a3
408 changed files with 2656 additions and 2165 deletions

View File

@ -22,7 +22,7 @@
*/
package com.iluwatar.converter;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* App running test

View File

@ -23,13 +23,13 @@
package com.iluwatar.converter;
import com.google.common.collect.Lists;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import static junit.framework.TestCase.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Tests for {@link Converter}
@ -41,7 +41,8 @@ public class ConverterTest {
/**
* Tests whether a converter created of opposite functions holds equality as a bijection.
*/
@Test public void testConversionsStartingFromDomain() {
@Test
public void testConversionsStartingFromDomain() {
User u1 = new User("Tom", "Hanks", true, "tom@hanks.com");
User u2 = userConverter.convertFromDto(userConverter.convertFromEntity(u1));
assertEquals(u1, u2);
@ -50,7 +51,8 @@ public class ConverterTest {
/**
* Tests whether a converter created of opposite functions holds equality as a bijection.
*/
@Test public void testConversionsStartingFromDto() {
@Test
public void testConversionsStartingFromDto() {
UserDto u1 = new UserDto("Tom", "Hanks", true, "tom@hanks.com");
UserDto u2 = userConverter.convertFromEntity(userConverter.convertFromDto(u1));
assertEquals(u1, u2);
@ -60,7 +62,8 @@ public class ConverterTest {
* Tests the custom users converter. Thanks to Java8 lambdas, converter can be easily and
* cleanly instantiated allowing various different conversion strategies to be implemented.
*/
@Test public void testCustomConverter() {
@Test
public void testCustomConverter() {
Converter<UserDto, User> converter = new Converter<>(
userDto -> new User(userDto.getFirstName(), userDto.getLastName(), userDto.isActive(),
String.valueOf(new Random().nextInt())),
@ -75,7 +78,8 @@ public class ConverterTest {
* Test whether converting a collection of Users to DTO Users and then converting them back to domain
* users returns an equal collection.
*/
@Test public void testCollectionConversion() {
@Test
public void testCollectionConversion() {
ArrayList<User> users = Lists.newArrayList(new User("Camile", "Tough", false, "124sad"),
new User("Marti", "Luther", true, "42309fd"), new User("Kate", "Smith", true, "if0243"));
List<User> fromDtos = userConverter.createFromDtos(userConverter.createFromEntities(users));