Skip to content

Commit aafd50a

Browse files
committed
1 parent 0177ac1 commit aafd50a

File tree

7 files changed

+11
-98
lines changed

7 files changed

+11
-98
lines changed

src/test/java/org/apache/ibatis/submitted/simplelistparameter/Car.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import java.util.List;
1919

2020
public class Car {
21-
// the result class doesn't need id for further processing
2221
private String name;
2322
private List<String> doors;
2423

@@ -30,11 +29,11 @@ public void setName(String name) {
3029
this.name = name;
3130
}
3231

33-
public List<String> getCarParts() {
32+
public List<String> getDoors() {
3433
return doors;
3534
}
3635

37-
public void setCarParts(List<String> doors) {
36+
public void setDoors(List<String> doors) {
3837
this.doors = doors;
3938
}
4039
}

src/test/java/org/apache/ibatis/submitted/simplelistparameter/CarMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121

2222
public interface CarMapper {
2323

24-
@Select({ "select id, name from car where doors = #{doors[1]}" })
24+
@Select({ "select name from car where doors = #{doors[1]}" })
2525
List<Car> getCar(Car car);
2626
}

src/test/java/org/apache/ibatis/submitted/simplelistparameter/CreateDB.sql

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
drop table car if exists;
1818

1919
create table car (
20-
id int,
2120
name varchar(20),
2221
doors int
2322
);
2423

25-
insert into car (id, name, doors) values(1, 'Audi', 4);
26-
insert into car (id, name, doors) values(2, 'Ford', 4);
27-
insert into car (id, name, doors) values(3, 'Fiat', 4);
24+
insert into car (name, doors) values('Audi', 4);
25+
insert into car (name, doors) values('Ford', 4);
26+
insert into car (name, doors) values('Fiat', 4);

src/test/java/org/apache/ibatis/submitted/simplelistparameter/Map.xml

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/test/java/org/apache/ibatis/submitted/simplelistparameter/Part.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/test/java/org/apache/ibatis/submitted/simplelistparameter/SimpleListParameterTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.apache.ibatis.session.SqlSession;
2626
import org.apache.ibatis.session.SqlSessionFactory;
2727
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
28-
import org.hsqldb.lib.ArraySort;
2928
import org.junit.Assert;
3029
import org.junit.BeforeClass;
3130
import org.junit.Test;
@@ -37,7 +36,7 @@ public class SimpleListParameterTest {
3736
@BeforeClass
3837
public static void setUp() throws Exception {
3938
// create a SqlSessionFactory
40-
Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/simplelistparameter/MapperConfig.xml");
39+
Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/simplelistparameter/mybatis-config.xml");
4140
sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
4241
reader.close();
4342

@@ -53,12 +52,12 @@ public static void setUp() throws Exception {
5352
}
5453

5554
@Test
56-
public void shouldMapResultsWithoutActuallyWritingIdProperties() throws Exception {
55+
public void shouldGetACar() throws Exception {
5756
SqlSession sqlSession = sqlSessionFactory.openSession();
5857
try {
5958
CarMapper carMapper = sqlSession.getMapper(CarMapper.class);
6059
Car car = new Car();
61-
car.setCarParts(Arrays.asList(new String[] {"2", "4"}));
60+
car.setDoors(Arrays.asList(new String[] {"2", "4"}));
6261
List<Car> cars = carMapper.getCar(car);
6362
Assert.assertNotNull(cars);
6463
} finally {

src/test/java/org/apache/ibatis/submitted/simplelistparameter/MapperConfig.xml renamed to src/test/java/org/apache/ibatis/submitted/simplelistparameter/mybatis-config.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<!--
33
4-
Copyright 2009-2011 The MyBatis Team
4+
Copyright 2009-2012 The MyBatis Team
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -23,10 +23,6 @@
2323

2424
<configuration>
2525

26-
<settings>
27-
<setting name="mapUnderscoreToCamelCase" value="true" />
28-
</settings>
29-
3026
<typeAliases>
3127
<package name="org/apache/ibatis/submitted/simplelistparameter" />
3228
</typeAliases>
@@ -45,7 +41,7 @@
4541
</environments>
4642

4743
<mappers>
48-
<mapper resource="org/apache/ibatis/submitted/simplelistparameter/Map.xml" />
44+
<mapper class="org.apache.ibatis.submitted.simplelistparameter.CarMapper" />
4945
</mappers>
5046

5147
</configuration>

0 commit comments

Comments
 (0)