Add another test to ensure proper exception gets thrown when no proper constructor can be found

This commit is contained in:
Travis Burtrum 2015-03-16 14:50:08 -04:00
parent d0e71273f1
commit 0c6a39eeb4

View File

@ -6,7 +6,6 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.lang.reflect.Constructor;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.*;
@ -245,6 +244,11 @@ public class QueryMapperTest {
Assert.assertArrayEquals(arr, qm.toObject("SELECT 1, 2, 3 FROM person WHERE person_no = ?", Long[].class, fieldPerson1.getPersonNo()));
}
@Test(expected = com.moparisthebest.jdbc.MapperException.class)
public void testNoDefaultConstructorFails() throws Throwable {
qm.toObject("SELECT 1, 2, 3 FROM person WHERE person_no = ?", Long.class, fieldPerson1.getPersonNo());
}
private List<Map<String, String>> getListMap() {
final List<Map<String, String>> arrayMap = new ArrayList<Map<String, String>>();
for (final Person person : new Person[]{fieldPerson1, fieldBoss1, fieldBoss2}) {