Skip to content

Commit

Permalink
HSEARCH-2219 Fix ResourceNotFoundMessageTest: make sure the analyzer …
Browse files Browse the repository at this point in the history
…initialization is performed
  • Loading branch information
yrodiere authored and Sanne committed Dec 19, 2016
1 parent cfda4e0 commit 7c34532
Showing 1 changed file with 13 additions and 2 deletions.
Expand Up @@ -7,6 +7,9 @@

package org.hibernate.search.test.configuration;

import javax.persistence.Entity;
import javax.persistence.Id;

import org.apache.lucene.analysis.core.LowerCaseFilterFactory;
import org.apache.lucene.analysis.standard.StandardTokenizerFactory;
import org.apache.lucene.analysis.core.StopFilterFactory;
Expand All @@ -31,7 +34,7 @@ public class ResourceNotFoundMessageTest {
public void testIllegalAnalyzerDefinition() {
try {
new FullTextSessionBuilder()
.addAnnotatedClass( User.class )
.addAnnotatedClass( SomeHibernateEntity.class )
.setProperty( Environment.MODEL_MAPPING, ResourceNotFoundMessageTest.class.getName() )
.build();
Assert.fail( "should not reach this" );
Expand All @@ -49,7 +52,15 @@ public SearchMapping build() {
.analyzerDef( "ngram", StandardTokenizerFactory.class )
.filter( LowerCaseFilterFactory.class )
.filter( StopFilterFactory.class )
.param( "words", "non-existent-resourcename.file" );
.param( "words", "non-existent-resourcename.file" )
// We must mark at least one entity as indexed, otherwise analyzer definitions are not initialized (no need to)
.entity( SomeHibernateEntity.class ).indexed();
return mapping;
}

@Entity
private static class SomeHibernateEntity {
@Id
private Long id;
}
}

0 comments on commit 7c34532

Please sign in to comment.