Search in sources :

Example 51 with Author

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

the class ExpressionEvaluatorTest method shouldReturnTrueIfNotZero.

@Test
public void shouldReturnTrueIfNotZero() {
    boolean value = evaluator.evaluateBoolean("id", new Author(1, "cbegin", null, "cbegin@apache.org", "N/A", Section.NEWS));
    assertEquals(true, value);
}
Also used : Author(org.apache.ibatis.domain.blog.Author) Test(org.junit.Test)

Example 52 with Author

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

the class ExpressionEvaluatorTest method shouldReturnFalseIfZero.

@Test
public void shouldReturnFalseIfZero() {
    boolean value = evaluator.evaluateBoolean("id", new Author(0, "cbegin", null, "cbegin@apache.org", "N/A", Section.NEWS));
    assertEquals(false, value);
}
Also used : Author(org.apache.ibatis.domain.blog.Author) Test(org.junit.Test)

Example 53 with Author

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

the class ExpressionEvaluatorTest method shouldReturnFalseIfNull.

@Test
public void shouldReturnFalseIfNull() {
    boolean value = evaluator.evaluateBoolean("password", new Author(1, "cbegin", null, "cbegin@apache.org", "N/A", Section.NEWS));
    assertEquals(false, value);
}
Also used : Author(org.apache.ibatis.domain.blog.Author) Test(org.junit.Test)

Example 54 with Author

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

the class JavassistProxyTest method shouldCreateAProxyForAPartiallyLoadedBean.

@Test
public void shouldCreateAProxyForAPartiallyLoadedBean() throws Exception {
    ResultLoaderMap loader = new ResultLoaderMap();
    loader.addLoader("id", null, null);
    Object proxy = proxyFactory.createProxy(author, loader, new Configuration(), new DefaultObjectFactory(), new ArrayList<Class<?>>(), new ArrayList<Object>());
    Author author2 = (Author) deserialize(serialize((Serializable) proxy));
    assertTrue(author2 instanceof Proxy);
}
Also used : Proxy(javassist.util.proxy.Proxy) Configuration(org.apache.ibatis.session.Configuration) DefaultObjectFactory(org.apache.ibatis.reflection.factory.DefaultObjectFactory) Author(org.apache.ibatis.domain.blog.Author) Test(org.junit.Test)

Example 55 with Author

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

the class SerializableProxyTest method shouldLetReadALoadedPropertyAfterSerialization.

@Test
public void shouldLetReadALoadedPropertyAfterSerialization() throws Exception {
    Object proxy = proxyFactory.createProxy(author, new ResultLoaderMap(), new Configuration(), new DefaultObjectFactory(), new ArrayList<Class<?>>(), new ArrayList<Object>());
    byte[] ser = serialize((Serializable) proxy);
    Author author2 = (Author) deserialize(ser);
    assertEquals(999, author2.getId());
}
Also used : Configuration(org.apache.ibatis.session.Configuration) DefaultObjectFactory(org.apache.ibatis.reflection.factory.DefaultObjectFactory) Author(org.apache.ibatis.domain.blog.Author) Test(org.junit.Test)

Aggregations

Author (org.apache.ibatis.domain.blog.Author)70 Test (org.junit.Test)68 BaseDataTest (org.apache.ibatis.BaseDataTest)45 ImmutableAuthor (org.apache.ibatis.domain.blog.ImmutableAuthor)20 MappedStatement (org.apache.ibatis.mapping.MappedStatement)14 AuthorMapper (org.apache.ibatis.domain.blog.mappers.AuthorMapper)13 DefaultObjectFactory (org.apache.ibatis.reflection.factory.DefaultObjectFactory)13 JdbcTransaction (org.apache.ibatis.transaction.jdbc.JdbcTransaction)12 ArrayList (java.util.ArrayList)8 Configuration (org.apache.ibatis.session.Configuration)7 SqlSession (org.apache.ibatis.session.SqlSession)7 HashMap (java.util.HashMap)4 Blog (org.apache.ibatis.domain.blog.Blog)3 DraftPost (org.apache.ibatis.domain.blog.DraftPost)3 Post (org.apache.ibatis.domain.blog.Post)3 StaticSqlSource (org.apache.ibatis.builder.StaticSqlSource)2 Comment (org.apache.ibatis.domain.blog.Comment)2 Section (org.apache.ibatis.domain.blog.Section)2 Tag (org.apache.ibatis.domain.blog.Tag)2 CglibProxyFactory (org.apache.ibatis.executor.loader.cglib.CglibProxyFactory)2