List of usage examples for junit.framework Assert assertNull
static public void assertNull(Object object)
From source file:org.apache.sling.etcd.client.impl.KeyResponseImplTest.java
@Test public void testActionResponse() throws Exception { KeyResponse response = new KeyResponseImpl(200, "OK", HEADERS, new JSONObject(IOUtils.toString(getClass().getResourceAsStream("/node-3.json")))); Assert.assertTrue(response.isAction()); Assert.assertNull(response.error()); Assert.assertNotNull(response.action()); }
From source file:org.apache.sling.etcd.client.impl.NodeImplTest.java
@Test public void testBasicNode() throws Exception { EtcdNode node = new EtcdNodeImpl( new JSONObject(IOUtils.toString(getClass().getResourceAsStream("/node-1.json")))); Assert.assertEquals(3, node.createdIndex()); Assert.assertEquals("/message", node.key()); Assert.assertEquals(3, node.modifiedIndex()); Assert.assertEquals("Hello etcd", node.value()); Assert.assertFalse(node.dir());//from w w w . j a va 2 s .c o m Assert.assertNull(node.expiration()); Assert.assertEquals(0, node.nodes().size()); Assert.assertNull(node.ttl()); }
From source file:org.apache.sling.etcd.client.impl.NodeImplTest.java
@Test public void testNodeWithSubNodes() throws Exception { EtcdNode node = new EtcdNodeImpl( new JSONObject(IOUtils.toString(getClass().getResourceAsStream("/node-3.json")))); Assert.assertEquals(2, node.createdIndex()); Assert.assertTrue(node.dir());//from w ww .j a v a 2 s .c o m Assert.assertEquals("/queue", node.key()); Assert.assertEquals(2, node.modifiedIndex()); Assert.assertNull(node.value()); Assert.assertNull(node.ttl()); List<EtcdNode> nodes = node.nodes(); Assert.assertNotNull(nodes); Assert.assertEquals(2, nodes.size()); EtcdNode child1 = nodes.get(0); Assert.assertEquals(2, child1.createdIndex()); Assert.assertEquals("/queue/2", child1.key()); Assert.assertEquals(2, child1.modifiedIndex()); Assert.assertEquals("Job1", child1.value()); Assert.assertEquals(0, child1.nodes().size()); }
From source file:org.apache.solr.client.solrj.io.stream.eval.AddEvaluatorTest.java
@Test public void addTwoFieldWithNulls() throws Exception { StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)"); Object result;/*from w w w .j a v a 2 s. c o m*/ values.clear(); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); }
From source file:org.apache.solr.client.solrj.io.stream.eval.AddEvaluatorTest.java
@Test public void addTwoFieldsWithNull() throws Exception { StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)"); Object result;/*from www .j av a 2s . c o m*/ values.clear(); values.put("a", 1); values.put("b", null); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); values.clear(); values.put("a", 1.1); values.put("b", null); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); values.clear(); values.put("a", null); values.put("b", 1.1); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); }
From source file:org.apache.solr.client.solrj.io.stream.eval.AddEvaluatorTest.java
@Test public void addTwoFieldsWithMissingField() throws Exception { StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)"); Object result;//ww w .java 2s. co m values.clear(); values.put("a", 1); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); values.clear(); values.put("a", 1.1); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); values.clear(); values.put("b", 1.1); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); }
From source file:org.apache.solr.client.solrj.io.stream.eval.MultiplyEvaluatorTest.java
@Test public void multTwoFieldWithNulls() throws Exception { StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)"); Object result;//from ww w . j av a 2 s . com values.clear(); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); }
From source file:org.apache.solr.client.solrj.io.stream.eval.MultiplyEvaluatorTest.java
@Test public void multTwoFieldsWithNull() throws Exception { StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)"); Object result;/*w w w.ja va 2s . co m*/ values.clear(); values.put("a", 1); values.put("b", null); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); values.clear(); values.put("a", null); values.put("b", 1.1); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); values.clear(); values.put("a", 1.1); values.put("b", null); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); }
From source file:org.apache.solr.client.solrj.io.stream.eval.MultiplyEvaluatorTest.java
@Test public void multTwoFieldsWithMissingField() throws Exception { StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)"); Object result;/* www.ja v a 2 s .c om*/ values.clear(); values.put("a", 1); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); values.clear(); values.put("b", 1.1); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); values.clear(); values.put("a", 1.1); result = evaluator.evaluate(new Tuple(values)); Assert.assertNull(result); }
From source file:org.apache.solr.client.solrj.io.stream.eval.RawValueEvaluatorTest.java
@Test public void rawTypes() throws Exception { Tuple tuple = new Tuple(values); Assert.assertEquals(10L, factory.constructEvaluator("val(10)").evaluate(tuple)); Assert.assertEquals(-10L, factory.constructEvaluator("val(-10)").evaluate(tuple)); Assert.assertEquals(0L, factory.constructEvaluator("val(0)").evaluate(tuple)); Assert.assertEquals(10.5, factory.constructEvaluator("val(10.5)").evaluate(tuple)); Assert.assertEquals(-10.5, factory.constructEvaluator("val(-10.5)").evaluate(tuple)); Assert.assertEquals(true, factory.constructEvaluator("val(true)").evaluate(tuple)); Assert.assertEquals(false, factory.constructEvaluator("val(false)").evaluate(tuple)); Assert.assertNull(factory.constructEvaluator("val(null)").evaluate(tuple)); }