Skip to content

Commit e4d81ff

Browse files
committed
增加spring-test。
1 parent 4070504 commit e4d81ff

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

pom.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@
113113
<groupId>org.springframework</groupId>
114114
<artifactId>spring-aop</artifactId>
115115
</dependency>
116+
<dependency>
117+
<groupId>org.springframework</groupId>
118+
<artifactId>spring-test</artifactId>
119+
</dependency>
116120

117121
<!--spring-oxm依赖-->
118122
<dependency>
@@ -202,7 +206,7 @@
202206
</dependencies>
203207
</dependencyManagement>
204208
<repositories>
205-
<repository>
209+
<!-- <repository>
206210
<id>nexus</id>
207211
<name>local private nexus</name>
208212
<url>http://maven.oschina.net/content/groups/public/</url>
@@ -212,7 +216,7 @@
212216
<snapshots>
213217
<enabled>false</enabled>
214218
</snapshots>
215-
</repository>
219+
</repository>-->
216220
<repository>
217221
<id>sonatype-nexus-releases</id>
218222
<name>Sonatype Nexus Releases</name>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.isea533.mybatis.test;
2+
3+
import org.junit.runner.RunWith;
4+
import org.springframework.test.context.ContextConfiguration;
5+
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
6+
7+
/**
8+
* Created by liuzh on 2015/3/7.
9+
*/
10+
@RunWith(SpringJUnit4ClassRunner.class)
11+
@ContextConfiguration("classpath:applicationContext.xml")
12+
public class BasicTest {
13+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.isea533.mybatis.test;
2+
3+
import com.github.abel533.entity.EntityMapper;
4+
import com.github.abel533.entity.Example;
5+
import com.github.pagehelper.PageHelper;
6+
import com.github.pagehelper.PageInfo;
7+
import com.isea533.mybatis.model.Country;
8+
import org.junit.Test;
9+
import org.springframework.beans.factory.annotation.Autowired;
10+
11+
import java.util.List;
12+
13+
/**
14+
* Created by liuzh on 2015/3/7.
15+
*/
16+
public class PageEntityMapperTest extends BasicTest {
17+
18+
@Autowired
19+
private EntityMapper entityMapper;
20+
21+
@Test
22+
public void test(){
23+
Example example = new Example(Country.class);
24+
example.createCriteria().andGreaterThan("id",100);
25+
PageHelper.startPage(2,10);
26+
List<Country> countries = entityMapper.selectByExample(example);
27+
PageInfo<Country> pageInfo = new PageInfo<Country>(countries);
28+
System.out.println(pageInfo.getTotal());
29+
}
30+
}

0 commit comments

Comments
 (0)