Skip to content

Commit e94d49c

Browse files
committed
Just corrected indentation before modification.
1 parent 9a9ee5e commit e94d49c

File tree

1 file changed

+74
-74
lines changed

1 file changed

+74
-74
lines changed

src/test/java/org/apache/ibatis/submitted/automapping/AutomappingTest.java

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -31,84 +31,84 @@
3131

3232
public class AutomappingTest {
3333

34-
private static SqlSessionFactory sqlSessionFactory;
34+
private static SqlSessionFactory sqlSessionFactory;
3535

36-
@BeforeClass
37-
public static void setUp() throws Exception {
38-
// create a SqlSessionFactory
39-
Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/automapping/mybatis-config.xml");
40-
sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
41-
reader.close();
36+
@BeforeClass
37+
public static void setUp() throws Exception {
38+
// create a SqlSessionFactory
39+
Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/automapping/mybatis-config.xml");
40+
sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
41+
reader.close();
4242

43-
// populate in-memory database
44-
SqlSession session = sqlSessionFactory.openSession();
45-
Connection conn = session.getConnection();
46-
reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/automapping/CreateDB.sql");
47-
ScriptRunner runner = new ScriptRunner(conn);
48-
runner.setLogWriter(null);
49-
runner.runScript(reader);
50-
reader.close();
51-
session.close();
52-
}
43+
// populate in-memory database
44+
SqlSession session = sqlSessionFactory.openSession();
45+
Connection conn = session.getConnection();
46+
reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/automapping/CreateDB.sql");
47+
ScriptRunner runner = new ScriptRunner(conn);
48+
runner.setLogWriter(null);
49+
runner.runScript(reader);
50+
reader.close();
51+
session.close();
52+
}
5353

54-
@Test
55-
public void shouldGetAUser() {
56-
SqlSession sqlSession = sqlSessionFactory.openSession();
57-
try {
58-
Mapper mapper = sqlSession.getMapper(Mapper.class);
59-
User user = mapper.getUser(1);
60-
Assert.assertEquals("User1", user.getName());
61-
} finally {
62-
sqlSession.close();
63-
}
64-
}
54+
@Test
55+
public void shouldGetAUser() {
56+
SqlSession sqlSession = sqlSessionFactory.openSession();
57+
try {
58+
Mapper mapper = sqlSession.getMapper(Mapper.class);
59+
User user = mapper.getUser(1);
60+
Assert.assertEquals("User1", user.getName());
61+
} finally {
62+
sqlSession.close();
63+
}
64+
}
6565

66-
@Test
67-
public void shouldGetAUserWithPets() {
68-
SqlSession sqlSession = sqlSessionFactory.openSession();
69-
try {
70-
Mapper mapper = sqlSession.getMapper(Mapper.class);
71-
User user = mapper.getUserWithPets(2);
72-
Assert.assertEquals(Integer.valueOf(2), user.getId());
73-
Assert.assertEquals("User2", user.getName());
74-
Assert.assertEquals(2, user.getPets().size());
75-
Assert.assertEquals(Integer.valueOf(12), user.getPets().get(0).getPetId());
76-
Assert.assertEquals("John", user.getPets().get(0).getBreeder().getBreederName());
77-
Assert.assertEquals("Kotetsu", user.getPets().get(1).getPetName());
78-
} finally {
79-
sqlSession.close();
80-
}
81-
}
66+
@Test
67+
public void shouldGetAUserWithPets() {
68+
SqlSession sqlSession = sqlSessionFactory.openSession();
69+
try {
70+
Mapper mapper = sqlSession.getMapper(Mapper.class);
71+
User user = mapper.getUserWithPets(2);
72+
Assert.assertEquals(Integer.valueOf(2), user.getId());
73+
Assert.assertEquals("User2", user.getName());
74+
Assert.assertEquals(2, user.getPets().size());
75+
Assert.assertEquals(Integer.valueOf(12), user.getPets().get(0).getPetId());
76+
Assert.assertEquals("John", user.getPets().get(0).getBreeder().getBreederName());
77+
Assert.assertEquals("Kotetsu", user.getPets().get(1).getPetName());
78+
} finally {
79+
sqlSession.close();
80+
}
81+
}
8282

83-
@Test
84-
public void shouldGetBooks() {
85-
//set automapping to default partial
86-
sqlSessionFactory.getConfiguration().setAutoMappingBehavior(AutoMappingBehavior.PARTIAL);
87-
SqlSession sqlSession = sqlSessionFactory.openSession();
88-
try {
89-
Mapper mapper = sqlSession.getMapper(Mapper.class);
90-
//no errors throw
91-
List<Book> books = mapper.getBooks();
92-
Assert.assertTrue("should return results,no errors throw", !books.isEmpty());
93-
} finally {
94-
sqlSession.close();
95-
}
96-
}
83+
@Test
84+
public void shouldGetBooks() {
85+
// set automapping to default partial
86+
sqlSessionFactory.getConfiguration().setAutoMappingBehavior(AutoMappingBehavior.PARTIAL);
87+
SqlSession sqlSession = sqlSessionFactory.openSession();
88+
try {
89+
Mapper mapper = sqlSession.getMapper(Mapper.class);
90+
// no errors throw
91+
List<Book> books = mapper.getBooks();
92+
Assert.assertTrue("should return results,no errors throw", !books.isEmpty());
93+
} finally {
94+
sqlSession.close();
95+
}
96+
}
9797

98-
@Test
99-
public void shouldUpdateFinalField() {
100-
//set automapping to default partial
101-
sqlSessionFactory.getConfiguration().setAutoMappingBehavior(AutoMappingBehavior.PARTIAL);
102-
SqlSession sqlSession = sqlSessionFactory.openSession();
103-
try {
104-
Mapper mapper = sqlSession.getMapper(Mapper.class);
105-
Article article = mapper.getArticle();
106-
//Java Language Specification 17.5.3 Subsequent Modification of Final Fields
107-
//http://docs.oracle.com/javase/specs/jls/se5.0/html/memory.html#17.5.3
108-
//The final field should be updated in mapping
109-
Assert.assertTrue("should update version in mapping", article.version > 0);
110-
} finally {
111-
sqlSession.close();
112-
}
113-
}
98+
@Test
99+
public void shouldUpdateFinalField() {
100+
// set automapping to default partial
101+
sqlSessionFactory.getConfiguration().setAutoMappingBehavior(AutoMappingBehavior.PARTIAL);
102+
SqlSession sqlSession = sqlSessionFactory.openSession();
103+
try {
104+
Mapper mapper = sqlSession.getMapper(Mapper.class);
105+
Article article = mapper.getArticle();
106+
// Java Language Specification 17.5.3 Subsequent Modification of Final Fields
107+
// http://docs.oracle.com/javase/specs/jls/se5.0/html/memory.html#17.5.3
108+
// The final field should be updated in mapping
109+
Assert.assertTrue("should update version in mapping", article.version > 0);
110+
} finally {
111+
sqlSession.close();
112+
}
113+
}
114114
}

0 commit comments

Comments
 (0)