2
2
3
3
import static org .junit .jupiter .api .Assertions .assertArrayEquals ;
4
4
import static org .junit .jupiter .api .Assertions .assertEquals ;
5
- import static org .junit .jupiter .api .Assertions .assertSame ;
6
5
7
6
import java .time .LocalDate ;
8
7
import java .util .Arrays ;
14
13
import info .unterrainer .commons .serialization .objectmapper .models .ObjectWithArray ;
15
14
import info .unterrainer .commons .serialization .objectmapper .models .ObjectWithObject ;
16
15
import info .unterrainer .commons .serialization .objectmapper .models .OtherObjectWithArray ;
17
- import info .unterrainer .commons .serialization .objectmapper .models .OtherObjectWithObject ;
18
16
import info .unterrainer .commons .serialization .objectmapper .models .OtherSimpleUser ;
19
17
import info .unterrainer .commons .serialization .objectmapper .models .SimpleUser ;
20
18
@@ -71,7 +69,7 @@ public void mappingComplexUserToSimpleUserWorks() {
71
69
cu .setDateTime (LocalDate .now ());
72
70
cu .setValue (100.00d );
73
71
SimpleUser su = SimpleUser .builder ().build ();
74
- su = oMapper .map (ComplexUser . class , SimpleUser . class , cu , su );
72
+ su = oMapper .map (cu , su );
75
73
assertEquals (su .getFirstName (), cu .getFirstName ());
76
74
assertEquals (su .getLastName (), cu .getLastName ());
77
75
}
@@ -84,7 +82,7 @@ public void mappingComplexUserToOtherSimpleUserWorks() {
84
82
cu .setDateTime (LocalDate .now ());
85
83
cu .setValue (100.00d );
86
84
OtherSimpleUser osu = OtherSimpleUser .builder ().build ();
87
- osu = oMapper .map (ComplexUser . class , OtherSimpleUser . class , cu , osu );
85
+ osu = oMapper .map (cu , osu );
88
86
assertEquals (osu .getFirstName (), cu .getFirstName ());
89
87
assertEquals (osu .getSurName (), cu .getLastName ());
90
88
}
@@ -95,7 +93,7 @@ public void mappingOtherSimpleUserToComplexUserWorks() {
95
93
su .setFirstName ("Danijel" );
96
94
su .setSurName ("Balog" );
97
95
ComplexUser cu = ComplexUser .builder ().build ();
98
- cu = oMapper .map (OtherSimpleUser . class , ComplexUser . class , su , cu );
96
+ cu = oMapper .map (su , cu );
99
97
assertEquals (su .getFirstName (), cu .getFirstName ());
100
98
assertEquals (su .getSurName (), cu .getLastName ());
101
99
}
@@ -107,7 +105,7 @@ public void mappingObjectWithArrayWorks() {
107
105
"Balog" ,
108
106
"Hallo"
109
107
};
110
- ObjectWithArray oArray = oMapper .map (String []. class , ObjectWithArray .class , array );
108
+ ObjectWithArray oArray = oMapper .map (ObjectWithArray .class , array );
111
109
assertArrayEquals (array , oArray .getObjects ());
112
110
}
113
111
@@ -119,14 +117,14 @@ public void mappingObjectWithArrayOfObjectsWorks() {
119
117
"Balog" ,
120
118
"Hallo"
121
119
});
122
- OtherObjectWithArray oArray = oMapper .map (ObjectWithArray . class , OtherObjectWithArray .class , array );
120
+ OtherObjectWithArray oArray = oMapper .map (OtherObjectWithArray .class , array );
123
121
assertArrayEquals (array .getObjects (), oArray .getObjects ());
124
122
}
125
123
126
124
@ Test
127
125
public void mappingObjectWithinObjectWorks () {
128
126
Integer i = 1234 ;
129
- ObjectWithObject oWO = oMapper .map (Integer . class , ObjectWithObject .class , i );
127
+ ObjectWithObject oWO = oMapper .map (ObjectWithObject .class , i );
130
128
assertEquals (i , oWO .getObject ());
131
129
}
132
130
}
0 commit comments