Skip to content

Conversation

@wonwoo
Copy link
Contributor

@wonwoo wonwoo commented Mar 4, 2017

Hello everybody,

this @wonwoo @MybatisTest similar to @DataJpaTest.
You can easily test Mybatis.

@RunWith(SpringRunner.class)
@MybatisTest
public class SampleDataMybatisTests {

  @Autowired
  private SampleMapper sampleMapper;

  @Autowired
  private SqlSession sqlSession;

  @Test
  public void sqlSessionIsNotNullTest() {
    assertThat(sqlSession).isNotNull();
  }

  @Test
  public void mapperIsNotNullTest() {
    assertThat(sampleMapper).isNotNull();
  }
}

are you okay?

Thank you in advance.

@eddumelendez
Copy link
Member

Thanks for the PR @wonwoo it is great! I will take a look

@eddumelendez
Copy link
Member

@wonwoo can you add new tests to the existing modules in mybatis-spring-boot-samples. Also, I think MybatisTest would be much better name. Thanks again.

@Documented
@Inherited
@ImportAutoConfiguration
public @interface AutoConfigureDataMybatis {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to AutoConfigureMybatis

@AutoConfigureCache
@Transactional
@AutoConfigureDataMybatis
public @interface DataMybatisTest {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to MybatisTest

/**
*
* @author wonwoo
* note : spring boot 1.5 add method excludeAutoConfiguration()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this note


/**
* {@link TypeExcludeFilter} for {@link DataMybatisTest @DataMybatisTest}.
* note : Spring boot 1.5 add method getComponentIncludes()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this note

* @author wonwoo
* @since 1.2.1
*/
class DataMybatisTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to MybatisTypeExcludeFilter

@wonwoo
Copy link
Contributor Author

wonwoo commented Mar 6, 2017

@eddumelendez rename class and remove note... and.. created sample code

Copy link
Member

@eddumelendez eddumelendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just few comments after everything is ok. Thanks again @wonwoo

<modules>
<module>mybatis-spring-boot-sample-annotation</module>
<module>mybatis-spring-boot-sample-xml</module>
<module>mybatis-spring-boot-sample-test</module>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new module is not necessary just add new test for the existing ones. Sorry to not be clear.

import org.springframework.test.context.BootstrapWith;
import org.springframework.transaction.annotation.Transactional;

import java.lang.annotation.*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid import *

@@ -0,0 +1,7 @@
# AutoConfigureDataMybatis auto-configuration imports
org.mybatis.spring.boot.test.autoconfigure.AutoConfigureMybatis=\
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove whitespace at the beginning

@wonwoo
Copy link
Contributor Author

wonwoo commented Mar 6, 2017

@eddumelendez remove test module and created test code in mybatis-spring-boot-samples

eddumelendez added a commit that referenced this pull request Mar 6, 2017
* pr/143:
  Polish contribution
  Add test slice for pure mybatis tests
@eddumelendez
Copy link
Member

Merged. Thanks!

@kazuki43zoo kazuki43zoo changed the title @DataMybatisTest similar to @DataJpaTest Add @MybatisTest similar to @DataJpaTest Mar 7, 2017
@kazuki43zoo kazuki43zoo added this to the 1.2.1 milestone Mar 7, 2017
@kazuki43zoo
Copy link
Member

I've changed title and description.

@kazuki43zoo
Copy link
Member

kazuki43zoo commented Mar 11, 2017

@eddumelendez

Is not need to include FlywayAutoConfiguration and LiquibaseAutoConfiguration into @AutoConfigureMybatis ?
The @AutoConfigureDataJpa include these auto-configure class.
I think these auto-configure class should be include into @AutoConfigureMybatis.
WDYT ?

Note:
Incidentally ... The @AutoConfigureJdbc that added at 1.5 include these auto-configure class.

@kazuki43zoo
Copy link
Member

ping @eddumelendez
WDYT about above comment ?

@kazuki43zoo
Copy link
Member

ping @eddumelendez

WDYT about #143 (comment) ?

@eddumelendez
Copy link
Member

Thanks for the reminder @kazuki43zoo check cfeeff4

@kazuki43zoo
Copy link
Member

@eddumelendez Thanks for fix !!

@kazuki43zoo
Copy link
Member

I've updated document via 7ac4b24.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants