Skip to content

Commit

Permalink
为了避免 travis-ci 编译错误,放开 weekend,增加 Rule,只有 jdk8+ 才会运行某些测试
Browse files Browse the repository at this point in the history
  • Loading branch information
abel533 committed Mar 5, 2018
1 parent f1b277b commit 3fdf2bb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 21 deletions.
23 changes: 2 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@
<module>core</module>
<module>extra</module>
<module>spring</module>
<!--为了可以在 jdk6,7上进行测试,这里排除 weekend-->
<!--<module>weekend</module>-->
<module>weekend</module>
<module>generator</module>
<module>spring-boot-starter</module>
</modules>
Expand All @@ -73,6 +72,7 @@
<jdk.version>1.6</jdk.version>
<jpa.version>1.0</jpa.version>
<slf4j.version>1.7.25</slf4j.version>
<mybatis.version>3.4.5</mybatis.version>
<!--test-->
<junit.version>4.12</junit.version>
<log4j.version>1.2.17</log4j.version>
Expand Down Expand Up @@ -172,15 +172,6 @@
</plugins>
</build>
<profiles>
<profile>
<id>mybatis-lastest</id>
<properties>
<mybatis.version>3.4.5</mybatis.version>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>mybatis-3.2.4</id>
<properties>
Expand All @@ -207,16 +198,6 @@
</profile>
<profile>
<id>release</id>
<modules>
<module>all</module>
<module>base</module>
<module>core</module>
<module>extra</module>
<module>spring</module>
<module>weekend</module>
<module>generator</module>
<module>spring-boot-starter</module>
</modules>
<build>
<plugins>
<!-- Javadoc -->
Expand Down
23 changes: 23 additions & 0 deletions weekend/src/test/java/tk/mybatis/mapper/weekend/UseJava8Rule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package tk.mybatis.mapper.weekend;

import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;

/**
* @author liuzh
*/
public class UseJava8Rule implements TestRule {
@Override
public Statement apply(final Statement base, final Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
String version = System.getProperty("java.version");
if (!version.contains("1.6.") && !version.contains("1.7.")) {
base.evaluate();
}
}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
package tk.mybatis.mapper.weekend;

import org.apache.ibatis.session.SqlSession;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
import tk.mybatis.mapper.weekend.entity.User;
import tk.mybatis.mapper.weekend.mapper.UserMapper;

Expand All @@ -38,6 +40,9 @@
*/
public class UserMapperTest {

@Rule
public TestRule runJava8 = new UseJava8Rule();

/**
* 执行,然后看日志打出来的SQL
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

import org.apache.ibatis.session.SqlSession;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.util.Sqls;
import tk.mybatis.mapper.weekend.entity.Country;
Expand All @@ -42,6 +44,9 @@
*/
public class WeekendSqlsTest {

@Rule
public TestRule runJava8 = new UseJava8Rule();

@Test
public void testWeekend() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
Expand Down

0 comments on commit 3fdf2bb

Please sign in to comment.