test that IllegalArgumentException is thrown if terms belong to different fields

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150635 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2004-11-10 11:39:25 +00:00
parent c23bb571c3
commit 49ab2ff423
1 changed files with 10 additions and 0 deletions

View File

@ -122,5 +122,15 @@ public class TestMultiPhraseQuery
result = searcher.search(query3);
assertEquals(2, result.length()); // blueberry pizza, blueberry chewing gum
assertEquals("body:\"(blueberry bluebird) pizza\"", query3.toString());
MultiPhraseQuery query4 = new MultiPhraseQuery();
try {
query4.add(new Term("field1", "foo"));
query4.add(new Term("field2", "foobar"));
fail();
} catch(IllegalArgumentException e) {
// okay, all terms must belong to the same field
}
}
}