Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
NullPointerException at org.slim3.datastore.ModelQuery.asQueryResultList(ModelQuery.java:295)
package pomu0325.model;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Test;
import org.slim3.datastore.Datastore;
import org.slim3.datastore.S3QueryResultList;
import org.slim3.tester.AppEngineTestCase;
import pomu0325.meta.PersonMeta;
public class PersonTest extends AppEngineTestCase {
@Test
public void test() throws Exception {
Person pomu0325 = new Person();
pomu0325.getSkill().add("Java");
pomu0325.getSkill().add("Scala");
Datastore.put(pomu0325);
PersonMeta meta = PersonMeta.get();
S3QueryResultList<Person> result1
= Datastore.query(meta).filter(meta.skill.in("Java")).asQueryResultList();
assertThat(result1.size(), is(1));
// NullPointerException is thrown at asQueryResultList() when using InCriterion with 2 or more values...
// at org.slim3.datastore.ModelQuery.asQueryResultList(ModelQuery.java:295)
S3QueryResultList<Person> result2
= Datastore.query(meta).filter(meta.skill.in("Java", "Scala")).asQueryResultList();
assertThat(result2.size(), is(1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.