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

@ -107,7 +107,7 @@ public class AbsoluteValueEvaluatorTest extends LuceneTestCase {
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;
@ -68,7 +69,7 @@ public class AddEvaluatorTest extends LuceneTestCase {
Assert.assertEquals(3.2D, result);
}
@Test
@Test(expected = IOException.class)
public void addTwoFieldWithNulls() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)");
Object result;
@ -78,7 +79,7 @@ public class AddEvaluatorTest extends LuceneTestCase {
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

@ -76,15 +76,15 @@ public class ArcCosineEvaluatorTest extends LuceneTestCase {
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

@ -76,7 +76,7 @@ public class ArcSineEvaluatorTest extends LuceneTestCase {
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

@ -76,15 +76,15 @@ public class ArcTangentEvaluatorTest extends LuceneTestCase {
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

@ -76,7 +76,7 @@ public class CeilingEvaluatorTest extends LuceneTestCase {
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;
@ -85,16 +86,16 @@ public class CoalesceEvaluatorTest extends LuceneTestCase {
}
@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{

View File

@ -76,7 +76,7 @@ public class CosineEvaluatorTest extends LuceneTestCase {
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

@ -76,15 +76,15 @@ public class CubedRootEvaluatorTest extends LuceneTestCase {
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

@ -76,21 +76,19 @@ public class FloorEvaluatorTest extends LuceneTestCase {
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

@ -76,7 +76,7 @@ public class HyperbolicCosineEvaluatorTest extends LuceneTestCase {
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

@ -76,7 +76,7 @@ public class HyperbolicSineEvaluatorTest extends LuceneTestCase {
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

@ -76,7 +76,7 @@ public class HyperbolicTangentEvaluatorTest extends LuceneTestCase {
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;
@ -86,7 +87,7 @@ public class MultiplyEvaluatorTest extends LuceneTestCase {
Assert.assertEquals(6.5D, result);
}
@Test
@Test(expected = IOException.class)
public void multTwoFieldWithNulls() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)");
Object result;
@ -96,7 +97,7 @@ public class MultiplyEvaluatorTest extends LuceneTestCase {
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

@ -94,7 +94,7 @@ public class PowerEvaluatorTest extends LuceneTestCase {
factory.constructEvaluator("pow(a)");
}
@Test
@Test(expected = IOException.class)
public void powTwoFieldWithNulls() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("pow(a,b)");

View File

@ -80,15 +80,15 @@ public class RoundEvaluatorTest extends LuceneTestCase {
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

@ -76,7 +76,7 @@ public class SineEvaluatorTest extends LuceneTestCase {
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

@ -76,7 +76,7 @@ public class SquareRootEvaluatorTest extends LuceneTestCase {
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

@ -74,7 +74,7 @@ public class SubtractEvaluatorTest extends LuceneTestCase {
factory.constructEvaluator("sub(a)");
}
@Test
@Test(expected = IOException.class)
public void subTwoFieldWithNulls() throws Exception{
StreamEvaluator evaluator = factory.constructEvaluator("sub(a,b)");
Object result;
@ -84,7 +84,7 @@ public class SubtractEvaluatorTest extends LuceneTestCase {
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

@ -76,7 +76,7 @@ public class TangentEvaluatorTest extends LuceneTestCase {
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