SOLR-11485: Fix broken tests

This commit is contained in:
Joel Bernstein 2017-12-04 22:46:43 -05:00
parent f8c69270a1
commit 862f48761c
22 changed files with 90 additions and 81 deletions

View File

@ -106,8 +106,8 @@ public class AbsoluteValueEvaluatorTest extends LuceneTestCase {
public void absTwoFields() throws Exception{
factory.constructEvaluator("abs(a,b)");
}
@Test
@Test(expected = IOException.class)
public void absNoValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("abs(a)");
@ -115,7 +115,8 @@ public class AbsoluteValueEvaluatorTest extends LuceneTestCase {
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void absNullValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("abs(a)");

View File

@ -16,6 +16,7 @@
*/
package org.apache.solr.client.solrj.io.stream.eval;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@ -67,8 +68,8 @@ public class AddEvaluatorTest extends LuceneTestCase {
Assert.assertTrue(result instanceof Double);
Assert.assertEquals(3.2D, result);
}
@Test
@Test(expected = IOException.class)
public void addTwoFieldWithNulls() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)");
Object result;
@ -77,8 +78,8 @@ public class AddEvaluatorTest extends LuceneTestCase {
result = evaluator.evaluate(new Tuple(values));
Assert.assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void addTwoFieldsWithNull() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)");
Object result;
@ -102,7 +103,7 @@ public class AddEvaluatorTest extends LuceneTestCase {
Assert.assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void addTwoFieldsWithMissingField() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)");
Object result;

View File

@ -75,16 +75,16 @@ public class ArcCosineEvaluatorTest extends LuceneTestCase {
public void twoFields() throws Exception{
factory.constructEvaluator("acos(a,b)");
}
@Test
@Test(expected = IOException.class)
public void noValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("acos(a)");
values.clear();
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void nullValue() throws Exception{
test(null);
}

View File

@ -75,8 +75,8 @@ public class ArcSineEvaluatorTest extends LuceneTestCase {
public void twoFields() throws Exception{
factory.constructEvaluator("asin(a,b)");
}
@Test
@Test(expected = IOException.class)
public void noValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("asin(a)");
@ -84,7 +84,8 @@ public class ArcSineEvaluatorTest extends LuceneTestCase {
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void nullValue() throws Exception{
test(null);
}

View File

@ -75,16 +75,16 @@ public class ArcTangentEvaluatorTest extends LuceneTestCase {
public void twoFields() throws Exception{
factory.constructEvaluator("atan(a,b)");
}
@Test
@Test(expected = IOException.class)
public void noValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("atan(a)");
values.clear();
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void nullValue() throws Exception{
test(null);
}

View File

@ -75,8 +75,8 @@ public class CeilingEvaluatorTest extends LuceneTestCase {
public void ceilTwoFields() throws Exception{
factory.constructEvaluator("ceil(a,b)");
}
@Test
@Test(expected = IOException.class)
public void ceilNoValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("ceil(a)");
@ -84,7 +84,8 @@ public class CeilingEvaluatorTest extends LuceneTestCase {
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void ceilNullValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("ceil(a)");

View File

@ -16,6 +16,7 @@
*/
package org.apache.solr.client.solrj.io.stream.eval;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@ -40,9 +41,9 @@ public class CoalesceEvaluatorTest extends LuceneTestCase {
.withFunctionName("coalesce", CoalesceEvaluator.class);
values = new HashMap<String,Object>();
}
@Test
public void twoFieldsWithValues() throws Exception{
/*
@Test(expected = IOException.class)
public void twoFieldsWithMissingField() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("coalesce(a,b)");
Object result;
@ -83,19 +84,19 @@ public class CoalesceEvaluatorTest extends LuceneTestCase {
result = evaluator.evaluate(new Tuple(values));
Assert.assertNull(result);
}
@Test
public void twoFieldsWithMissingField() throws Exception{
@Test(expected = IOException.class)
public void twoFieldsWithValues() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("coalesce(a,b)");
Object result;
values.clear();
result = evaluator.evaluate(new Tuple(values));
Assert.assertNull(result);
}
*/
@Test
public void manyFieldsWithSubcoalesces() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("coalesce(a,b,coalesce(c,d))");

View File

@ -75,8 +75,8 @@ public class CosineEvaluatorTest extends LuceneTestCase {
public void twoFields() throws Exception{
factory.constructEvaluator("cos(a,b)");
}
@Test
@Test(expected = IOException.class)
public void noValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("cos(a)");
@ -84,7 +84,7 @@ public class CosineEvaluatorTest extends LuceneTestCase {
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void nullValue() throws Exception{
test(null);
}

View File

@ -75,16 +75,16 @@ public class CubedRootEvaluatorTest extends LuceneTestCase {
public void twoFields() throws Exception{
factory.constructEvaluator("cbrt(a,b)");
}
@Test
@Test(expected = IOException.class)
public void noValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("cbrt(a)");
values.clear();
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void nullValue() throws Exception{
test(null);
}

View File

@ -75,22 +75,20 @@ public class FloorEvaluatorTest extends LuceneTestCase {
public void floorTwoFields() throws Exception{
factory.constructEvaluator("floor(a,b)");
}
@Test
@Test(expected = IOException.class)
public void floorNoValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("floor(a)");
values.clear();
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void floorNullValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("floor(a)");
values.clear();
values.put("a", null);
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
}

View File

@ -75,8 +75,8 @@ public class HyperbolicCosineEvaluatorTest extends LuceneTestCase {
public void twoFields() throws Exception{
factory.constructEvaluator("cosh(a,b)");
}
@Test
@Test(expected = IOException.class)
public void noValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("cosh(a)");
@ -84,7 +84,8 @@ public class HyperbolicCosineEvaluatorTest extends LuceneTestCase {
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void nullValue() throws Exception{
test(null);
}

View File

@ -75,8 +75,8 @@ public class HyperbolicSineEvaluatorTest extends LuceneTestCase {
public void twoFields() throws Exception{
factory.constructEvaluator("sinh(a,b)");
}
@Test
@Test(expected = IOException.class)
public void noValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("sinh(a)");
@ -84,7 +84,8 @@ public class HyperbolicSineEvaluatorTest extends LuceneTestCase {
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void nullValue() throws Exception{
test(null);
}

View File

@ -75,8 +75,8 @@ public class HyperbolicTangentEvaluatorTest extends LuceneTestCase {
public void twoFields() throws Exception{
factory.constructEvaluator("tanh(a,b)");
}
@Test
@Test(expected = IOException.class)
public void noValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("tanh(a)");
@ -84,7 +84,8 @@ public class HyperbolicTangentEvaluatorTest extends LuceneTestCase {
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void nullValue() throws Exception{
test(null);
}

View File

@ -16,6 +16,7 @@
*/
package org.apache.solr.client.solrj.io.stream.eval;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@ -85,8 +86,8 @@ public class MultiplyEvaluatorTest extends LuceneTestCase {
Assert.assertTrue(result instanceof Double);
Assert.assertEquals(6.5D, result);
}
@Test
@Test(expected = IOException.class)
public void multTwoFieldWithNulls() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)");
Object result;
@ -95,8 +96,8 @@ public class MultiplyEvaluatorTest extends LuceneTestCase {
result = evaluator.evaluate(new Tuple(values));
Assert.assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void multTwoFieldsWithNull() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)");
Object result;
@ -120,7 +121,7 @@ public class MultiplyEvaluatorTest extends LuceneTestCase {
Assert.assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void multTwoFieldsWithMissingField() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)");
Object result;

View File

@ -78,7 +78,7 @@ public class NaturalLogEvaluatorTest extends LuceneTestCase {
factory.constructEvaluator("log(a,b)");
}
@Test
@Test(expected = IOException.class)
public void logNoValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("log(a)");
@ -86,7 +86,8 @@ public class NaturalLogEvaluatorTest extends LuceneTestCase {
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void logNullValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("log(a)");

View File

@ -93,15 +93,15 @@ public class PowerEvaluatorTest extends LuceneTestCase {
public void powOneField() throws Exception{
factory.constructEvaluator("pow(a)");
}
@Test
@Test(expected = IOException.class)
public void powTwoFieldWithNulls() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("pow(a,b)");
values.clear();
Assert.assertNull(evaluator.evaluate(new Tuple(values)));
}
@Test
public void powManyFieldsWithSubpows() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("pow(a,pow(b,c))");

View File

@ -79,16 +79,16 @@ public class RoundEvaluatorTest extends LuceneTestCase {
public void twoFields() throws Exception{
factory.constructEvaluator("round(a,b)");
}
@Test
@Test(expected = IOException.class)
public void noValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("round(a)");
values.clear();
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void nullValue() throws Exception{
test(null);
}

View File

@ -75,8 +75,8 @@ public class SineEvaluatorTest extends LuceneTestCase {
public void twoFields() throws Exception{
factory.constructEvaluator("sin(a,b)");
}
@Test
@Test(expected = IOException.class)
public void noValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("sin(a)");
@ -84,7 +84,8 @@ public class SineEvaluatorTest extends LuceneTestCase {
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void nullValue() throws Exception{
test(null);
}

View File

@ -75,8 +75,8 @@ public class SquareRootEvaluatorTest extends LuceneTestCase {
public void twoFields() throws Exception{
factory.constructEvaluator("sqrt(a,b)");
}
@Test
@Test(expected = IOException.class)
public void noValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("sqrt(a)");
@ -84,7 +84,8 @@ public class SquareRootEvaluatorTest extends LuceneTestCase {
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void nullValue() throws Exception{
test(null);
}

View File

@ -73,8 +73,8 @@ public class SubtractEvaluatorTest extends LuceneTestCase {
public void subOneField() throws Exception{
factory.constructEvaluator("sub(a)");
}
@Test
@Test(expected = IOException.class)
public void subTwoFieldWithNulls() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("sub(a,b)");
Object result;
@ -83,8 +83,8 @@ public class SubtractEvaluatorTest extends LuceneTestCase {
result = evaluator.evaluate(new Tuple(values));
Assert.assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void subTwoFieldsWithNull() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("sub(a,b)");
Object result;
@ -108,7 +108,7 @@ public class SubtractEvaluatorTest extends LuceneTestCase {
Assert.assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void subTwoFieldsWithMissingField() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("sub(a,b)");
Object result;

View File

@ -75,8 +75,8 @@ public class TangentEvaluatorTest extends LuceneTestCase {
public void twoFields() throws Exception{
factory.constructEvaluator("tan(a,b)");
}
@Test
@Test(expected = IOException.class)
public void noValue() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("tan(a)");
@ -84,7 +84,8 @@ public class TangentEvaluatorTest extends LuceneTestCase {
Object result = evaluator.evaluate(new Tuple(values));
assertNull(result);
}
@Test
@Test(expected = IOException.class)
public void nullValue() throws Exception{
test(null);
}

View File

@ -157,8 +157,6 @@ public class TemporalEvaluatorsTest {
}
values.clear();
values.put("a", null);
assertNull(evaluator.evaluate(new Tuple(values)));
}
@Test