fix: Ignore if field does not exist
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package np.com.krrish;
|
||||
|
||||
public class Destination {
|
||||
private String first;
|
||||
private String second;
|
||||
|
||||
public String getFirst() {
|
||||
String getFirst() {
|
||||
return first;
|
||||
}
|
||||
|
@@ -1,3 +1,5 @@
|
||||
package np.com.krrish;
|
||||
|
||||
import org.junit.jupiter.api.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
@@ -13,7 +15,7 @@ class MapperTest {
|
||||
@Test
|
||||
void testEmptyFieldsMap() {
|
||||
Source source = new Source();
|
||||
Object destination = mapper.map(source, "Destination");
|
||||
Object destination = mapper.map(source, "np.com.krrish.Destination");
|
||||
assertEquals(Destination.class, destination.getClass());
|
||||
}
|
||||
|
||||
@@ -23,7 +25,7 @@ class MapperTest {
|
||||
source.setFirst("first");
|
||||
source.setSecond("second");
|
||||
|
||||
Destination destination = (Destination) mapper.map(source, "Destination");
|
||||
Destination destination = (Destination) mapper.map(source, "np.com.krrish.Destination");
|
||||
assertEquals("first", destination.getFirst());
|
||||
}
|
||||
}
|
@@ -1,12 +1,14 @@
|
||||
package np.com.krrish;
|
||||
|
||||
public class Source {
|
||||
private String first;
|
||||
private String second;
|
||||
|
||||
public void setFirst(String first) {
|
||||
void setFirst(String first) {
|
||||
this.first = first;
|
||||
}
|
||||
|
||||
public void setSecond(String second) {
|
||||
void setSecond(String second) {
|
||||
this.second = second;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user