@Test public void positiveWildcardTest() throws AssertionException { assertion.setPath("for $f in //step[1]/html_instructions return $f"); assertion.setExpectedContent("<html_instructions>Head *</html_instructions>"); assertion.setAllowWildcards(true); assertion.assertContent(response, context, XQueryContainsAssertion.ID); }
@Test public void positiveLatitudeTest() throws AssertionException { assertion.setPath("/DirectionsResponse/route[1]/leg[1]/step[1]/start_location[1]/lat[1]"); assertion.setExpectedContent("<lat>-34.9286900</lat>"); String result = assertion.assertContent(response, context, XQueryContainsAssertion.ID); assertEquals( "Not matched expected!", "XQuery Match matches content for [/DirectionsResponse/route[1]/leg[1]/step[1]/start_location[1]/lat[1]]", result); }
@Test public void positiveRouteTest() throws AssertionException { assertion.setPath("count(DirectionsResponse/route) > 10"); assertion.setExpectedContent("false"); String result = assertion.assertContent(response, context, XQueryContainsAssertion.ID); assertEquals( "Not matched expected!", "XQuery Match matches content for [count(DirectionsResponse/route) > 10]", result); }
@Test(expected = AssertionException.class) public void negativeLatitudeTest() throws AssertionException { assertion.setPath("/DirectionsResponse/route[1]/leg[1]/step[1]/start_location[1]/lat[1]"); assertion.setExpectedContent("<lat>-35.9286900</lat>"); assertion.assertContent(response, context, XQueryContainsAssertion.ID); }
@Test(expected = AssertionException.class) public void negativeRouteTest() throws AssertionException { assertion.setPath("count(DirectionsResponse/route) > 10"); assertion.setExpectedContent("true"); assertion.assertContent(response, context, XQueryContainsAssertion.ID); }