Skip to content

@MyBatisTest does not work #164

Closed
Closed
@aisensiy

Description

@aisensiy

Use the new org.mybatis.spring.boot:mybatis-spring-boot-starter-test:1.3.0 but the @MyBatisTest annotation does not exists...

buildscript {
	ext {
		springBootVersion = '1.5.3.RELEASE'
	}
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
	}
}

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'

version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
	mavenCentral()
}


dependencies {
	compile('org.flywaydb:flyway-core')
	compile('org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.0')
	compile('org.springframework.boot:spring-boot-starter-web')
	runtime('org.springframework.boot:spring-boot-devtools')
	compile('com.h2database:h2:1.4.194')
	compileOnly('org.projectlombok:lombok')
	testCompile('org.mybatis.spring.boot:mybatis-spring-boot-starter-test:1.3.0')
	testCompile('org.springframework.boot:spring-boot-starter-test')
}
@RunWith(SpringRunner.class)
@MyBatisTest // <--- not exists!!!!!
@Import(MyBatisUserRepository.class)
public class MyBatisUserRepositoryTest {
    @Autowired
    private UserRepository userRepository;

    @Test
    public void should_create_user_success() throws Exception {
        User user = new User(UUID.randomUUID().toString(), "xushanchuan");
        userRepository.save(user);
        Optional<User> optional = userRepository.findById(user.getId());
        assertThat(optional.get(), is(user));
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions