use of com.querydsl.lucene5.TermElement in project querydsl by querydsl.
the class TermElementTest method testEqualsAndHashCode.
@Test
public void testEqualsAndHashCode() {
TermElement el1 = new TermElement("x"), el2 = new TermElement("x"), el3 = new TermElement("y");
assertEquals(el1, el2);
assertFalse(el1.equals(el3));
assertEquals(el1.hashCode(), el2.hashCode());
}
use of com.querydsl.lucene5.TermElement in project querydsl by querydsl.
the class TermElementTest method test.
@Test
public void test() {
StringPath title = Expressions.stringPath("title");
LuceneSerializer serializer = new LuceneSerializer(false, true);
QueryMetadata metadata = new DefaultQueryMetadata();
assertEquals("title:\"Hello World\"", serializer.toQuery(title.eq("Hello World"), metadata).toString());
assertEquals("title:Hello World", serializer.toQuery(title.eq(new TermElement("Hello World")), metadata).toString());
}
Aggregations