Search in sources :

Example 1 with DraftPost

use of org.apache.ibatis.domain.blog.DraftPost in project mybatis-3 by mybatis.

the class BindingTest method shouldSelectDraftTypedPostsWithResultMap.

@Test
void shouldSelectDraftTypedPostsWithResultMap() {
    try (SqlSession session = sqlSessionFactory.openSession()) {
        BoundBlogMapper mapper = session.getMapper(BoundBlogMapper.class);
        List<Post> posts = mapper.selectPostsWithResultMap();
        assertEquals(5, posts.size());
        assertTrue(posts.get(0) instanceof DraftPost);
        assertFalse(posts.get(1) instanceof DraftPost);
        assertTrue(posts.get(2) instanceof DraftPost);
        assertFalse(posts.get(3) instanceof DraftPost);
        assertFalse(posts.get(4) instanceof DraftPost);
    }
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) DraftPost(org.apache.ibatis.domain.blog.DraftPost) Post(org.apache.ibatis.domain.blog.Post) DraftPost(org.apache.ibatis.domain.blog.DraftPost) BaseDataTest(org.apache.ibatis.BaseDataTest) Test(org.junit.jupiter.api.Test)

Example 2 with DraftPost

use of org.apache.ibatis.domain.blog.DraftPost in project mybatis-3 by mybatis.

the class BindingTest method shouldSelectDraftTypedPosts.

@Test
void shouldSelectDraftTypedPosts() {
    try (SqlSession session = sqlSessionFactory.openSession()) {
        BoundBlogMapper mapper = session.getMapper(BoundBlogMapper.class);
        List<Post> posts = mapper.selectPosts();
        assertEquals(5, posts.size());
        assertTrue(posts.get(0) instanceof DraftPost);
        assertFalse(posts.get(1) instanceof DraftPost);
        assertTrue(posts.get(2) instanceof DraftPost);
        assertFalse(posts.get(3) instanceof DraftPost);
        assertFalse(posts.get(4) instanceof DraftPost);
    }
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) DraftPost(org.apache.ibatis.domain.blog.DraftPost) Post(org.apache.ibatis.domain.blog.Post) DraftPost(org.apache.ibatis.domain.blog.DraftPost) BaseDataTest(org.apache.ibatis.BaseDataTest) Test(org.junit.jupiter.api.Test)

Aggregations

BaseDataTest (org.apache.ibatis.BaseDataTest)2 DraftPost (org.apache.ibatis.domain.blog.DraftPost)2 Post (org.apache.ibatis.domain.blog.Post)2 SqlSession (org.apache.ibatis.session.SqlSession)2 Test (org.junit.jupiter.api.Test)2