//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void nonUniqueSamplingCancel() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void NonUniqueSamplingCancel() { Terms terms = GetTerms("test", 1); IDictionary <string, Terms> fieldTermsMap = MapUtil.genericMap("0string", terms, "id", terms, "0string", terms); IndexReaderStub indexReader = new IndexReaderStub(new SamplingFields(fieldTermsMap)); when(_indexSearcher.IndexReader).thenReturn(indexReader); NonUniqueLuceneIndexSampler luceneIndexSampler = CreateSampler(); _taskControl.cancel(); IndexNotFoundKernelException notFoundKernelException = assertThrows(typeof(IndexNotFoundKernelException), luceneIndexSampler.sampleIndex); assertEquals(notFoundKernelException.Message, "Index dropped while sampling."); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void samplingOfLargeNumericValues() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void SamplingOfLargeNumericValues() { using (RAMDirectory dir = new RAMDirectory(), WritableIndexPartition indexPartition = new WritableIndexPartition(new File("testPartition"), dir, IndexWriterConfigs.standard())) { InsertDocument(indexPartition, 1, long.MaxValue); InsertDocument(indexPartition, 2, int.MaxValue); indexPartition.MaybeRefreshBlocking(); using (PartitionSearcher searcher = indexPartition.AcquireSearcher()) { NonUniqueLuceneIndexSampler sampler = new NonUniqueLuceneIndexSampler(searcher.IndexSearcher, _taskControl.newInstance(), new IndexSamplingConfig(Config.defaults())); assertEquals(new IndexSample(2, 2, 2), sampler.SampleIndex()); } } }