Renaming test methods and formatting
This commit is contained in:
parent
43852c4303
commit
d1b282220d
|
@ -7,10 +7,10 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author sasam0320
|
||||
* @description
|
||||
* This is a helper class that contains methods for generic mapping of the users list.
|
||||
* Initially, an instance of ModelMapper was created. In the static block we set the matching configuration to STRICT.
|
||||
*
|
||||
* @author sasam0320
|
||||
*/
|
||||
public class MapperUtil {
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.baeldung.modelmapper;
|
||||
|
||||
/**
|
||||
* User model entity class
|
||||
* @author sasam0320
|
||||
* @description User model entity class
|
||||
*/
|
||||
public class User {
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.baeldung.modelmapper;
|
||||
|
||||
/**
|
||||
* UserDTO model class
|
||||
* @author sasam0320
|
||||
* @description UserDTO model class
|
||||
*/
|
||||
public class UserDTO {
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package com.baeldung.modelmapper;
|
|||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* UserList class that contain collection of users
|
||||
* @author sasam0320
|
||||
* @description UserList class that contain collection of users
|
||||
*/
|
||||
public class UserList {
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package com.baeldung.modelmapper;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* UserListDTO class that contain list of username properties
|
||||
* @author sasam0320
|
||||
* @description UserListDTO class that contain list of username properties
|
||||
*/
|
||||
public class UserListDTO {
|
||||
|
||||
|
|
|
@ -7,10 +7,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author sasam0320
|
||||
* @description
|
||||
* UserPropertyMap class instantiates the converter to map the data from the user list to the user name list.
|
||||
* In the configuration method, we call a converter to do the mapping.
|
||||
* @author sasam0320
|
||||
*/
|
||||
public class UserPropertyMap extends PropertyMap<UserList, UserListDTO> {
|
||||
|
||||
|
|
|
@ -13,18 +13,17 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
import static org.hamcrest.Matchers.hasItems;
|
||||
import static org.hamcrest.Matchers.hasProperty;
|
||||
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
|
||||
/**
|
||||
* @sasam0320
|
||||
* @description
|
||||
* This class has test methods of mapping Integer to Character list,
|
||||
* mapping user list to DTO list using MapperUtil generic methods and Converter
|
||||
*
|
||||
* @author sasam0320
|
||||
*/
|
||||
public class UserMappingTest {
|
||||
public class UsersListMappingUnitTest {
|
||||
|
||||
private ModelMapper mapper;
|
||||
private List<User> users;
|
||||
|
@ -42,7 +41,7 @@ public class UserMappingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMapIntegerList() {
|
||||
public void whenMapIntegerToCharList() {
|
||||
|
||||
List<Integer> integers = new ArrayList<Integer>();
|
||||
|
||||
|
@ -58,7 +57,7 @@ public class UserMappingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMapGenericTypeLists() {
|
||||
public void givenUsersList_whenUseGenericType_thenMapToDto() {
|
||||
|
||||
// Mapping lists using generic type methods
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
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>
|
||||
<artifactId>parent-java</artifactId>
|
||||
|
|
Loading…
Reference in New Issue