@Test public void constructorAllNull() throws XPathExpressionException { SubscriptionProperties p = new SubscriptionProperties(null, null, null); assertEquals(null, p.getNode()); assertEquals("", p.getFilter()); Object filter = p.getFilterXPath(); assertEquals("XPathExpressionHandler", filter.getClass().getSimpleName()); Object vars = p.getVariables(); assertEquals("ArrayList", vars.getClass().getSimpleName()); }
@Test public void constructorAllOK() throws XPathExpressionException { Variable[] vars = new Variable[2]; vars[0] = new Variable("FOO", "//foo"); vars[1] = new Variable("BAR", "//bar"); SubscriptionProperties p = new SubscriptionProperties("//foo/bar", "node", vars); assertEquals("node", p.getNode()); assertEquals("//foo/bar", p.getFilter()); assertEquals(2, p.getVariables().size()); assertEquals("FOO", ((Variable) p.getVariables().get(0)).getEnvName()); assertEquals("//foo", ((Variable) p.getVariables().get(0)).getEnvExpr()); assertEquals("BAR", ((Variable) p.getVariables().get(1)).getEnvName()); assertEquals("//bar", ((Variable) p.getVariables().get(1)).getEnvExpr()); }