mirror of https://github.com/apache/lucene.git
Fix compiler warnings in tests
This commit is contained in:
parent
113043b1ed
commit
9881dc031c
|
@ -4090,8 +4090,9 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSegmentCommitInfoId() throws IOException {
|
public void testSegmentCommitInfoId() throws IOException {
|
||||||
try (Directory dir = newDirectory();
|
try (Directory dir = newDirectory()) {
|
||||||
IndexWriter writer = new IndexWriter(dir,
|
SegmentInfos segmentCommitInfos;
|
||||||
|
try (IndexWriter writer = new IndexWriter(dir,
|
||||||
new IndexWriterConfig().setMergePolicy(NoMergePolicy.INSTANCE))) {
|
new IndexWriterConfig().setMergePolicy(NoMergePolicy.INSTANCE))) {
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
doc.add(new NumericDocValuesField("num", 1));
|
doc.add(new NumericDocValuesField("num", 1));
|
||||||
|
@ -4102,7 +4103,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
doc.add(new StringField("id", "2", Field.Store.NO));
|
doc.add(new StringField("id", "2", Field.Store.NO));
|
||||||
writer.addDocument(doc);
|
writer.addDocument(doc);
|
||||||
writer.commit();
|
writer.commit();
|
||||||
SegmentInfos segmentCommitInfos = SegmentInfos.readLatestCommit(dir);
|
segmentCommitInfos = SegmentInfos.readLatestCommit(dir);
|
||||||
byte[] id = segmentCommitInfos.info(0).getId();
|
byte[] id = segmentCommitInfos.info(0).getId();
|
||||||
byte[] segInfoId = segmentCommitInfos.info(0).info.getId();
|
byte[] segInfoId = segmentCommitInfos.info(0).info.getId();
|
||||||
|
|
||||||
|
@ -4129,7 +4130,8 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
assertEquals(3, segmentCommitInfos.size());
|
assertEquals(3, segmentCommitInfos.size());
|
||||||
assertNotEquals(StringHelper.idToString(id), StringHelper.idToString(segmentCommitInfos.info(0).getId()));
|
assertNotEquals(StringHelper.idToString(id), StringHelper.idToString(segmentCommitInfos.info(0).getId()));
|
||||||
assertEquals(StringHelper.idToString(segInfoId), StringHelper.idToString(segmentCommitInfos.info(0).info.getId()));
|
assertEquals(StringHelper.idToString(segInfoId), StringHelper.idToString(segmentCommitInfos.info(0).info.getId()));
|
||||||
writer.close();
|
}
|
||||||
|
|
||||||
try (Directory dir2 = newDirectory();
|
try (Directory dir2 = newDirectory();
|
||||||
IndexWriter writer2 = new IndexWriter(dir2,
|
IndexWriter writer2 = new IndexWriter(dir2,
|
||||||
new IndexWriterConfig().setMergePolicy(NoMergePolicy.INSTANCE))) {
|
new IndexWriterConfig().setMergePolicy(NoMergePolicy.INSTANCE))) {
|
||||||
|
|
Loading…
Reference in New Issue