Examples of CustomComparator


Examples of fitnesse.testsystems.slim.CustomComparator

        return null;
      }
      Matcher customComparatorMatcher = customComparatorPattern.matcher(expression);
      if (customComparatorMatcher.matches()) {
        String prefix = customComparatorMatcher.group(1);
        CustomComparator customComparator = customComparatorRegistry.getCustomComparatorForPrefix(prefix);
        if (customComparator != null) {
          String expectedString = customComparatorMatcher.group(2);
          try {
            if (customComparator.matches(actual, expectedString)) {
              message = SlimTestResult.pass(expectedString + " matches " + actual);
            } else {
              message = SlimTestResult.fail(expectedString + " doesn't match " + actual);
            }
          } catch (Throwable t) {
View Full Code Here

Examples of fitnesse.testsystems.slim.CustomComparator

  public void testCustomComparatorsCreation() throws PluginException {
    CustomComparatorRegistry customComparatorRegistry = new CustomComparatorRegistry();
    testProperties.setProperty(ConfigurationParameter.CUSTOM_COMPARATORS.getKey(), "test:" + TestCustomComparator.class.getName());
    loader.loadCustomComparators(customComparatorRegistry);

    CustomComparator customComparator = customComparatorRegistry.getCustomComparatorForPrefix("test");
    assertNotNull(customComparator);
    assertTrue(customComparator instanceof TestCustomComparator);
  }
View Full Code Here

Examples of org.skyscreamer.jsonassert.comparator.CustomComparator

  private static final JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);

  private void doTest(String jsonPath, ArrayValueMatcher<Object> arrayValueMatcher, String expectedJSON,
      String actualJSON) throws JSONException {
    Customization customization = new Customization(jsonPath, arrayValueMatcher);
    JSONAssert.assertEquals(expectedJSON, actualJSON, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here

Examples of org.skyscreamer.jsonassert.comparator.CustomComparator

  }

  @Test
  public void failsWhenInnerJSONObjectArrayElementDoesNotMatch() throws JSONException {
    ArrayValueMatcher<Object> innerArrayValueMatcher = new ArrayValueMatcher<Object>(comparator, 1);
    JSONComparator innerArrayComparator = new CustomComparator(
        JSONCompareMode.LENIENT, new Customization("a[2]", innerArrayValueMatcher));
    doFailingMatchTest("a",
        new ArrayValueMatcher<Object>(innerArrayComparator, 2)// tests inner array i.e. [12,13,14]
        "{a:[[99]]}",
        ARRAY_OF_JSONARRAYS,
View Full Code Here

Examples of org.skyscreamer.jsonassert.comparator.CustomComparator

   */
  @Test
  public void verifyIdAttributeOfFirstArrayElementMatches() throws JSONException {
    JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);
    Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator, 0));
    JSONAssert.assertEquals("{a:[{id:1}]}", ARRAY_OF_JSONOBJECTS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here

Examples of org.skyscreamer.jsonassert.comparator.CustomComparator

 
  @Test
  public void verifyIdAttributeOfFirstArrayElementMatchesSimplifiedExpectedSyntax() throws JSONException {
    JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);
    Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator, 0));
    JSONAssert.assertEquals("{a:{id:1}}", ARRAY_OF_JSONOBJECTS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here

Examples of org.skyscreamer.jsonassert.comparator.CustomComparator

 
  @Test
  public void verifyTypeAttributeOfSecondAndThirdElementMatchesRow() throws JSONException {
    JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);
    Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator, 1, 2));
    JSONAssert.assertEquals("{a:[{type:row}]}", ARRAY_OF_JSONOBJECTS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here

Examples of org.skyscreamer.jsonassert.comparator.CustomComparator

 
  @Test
  public void verifyTypeAttributeOfEveryArrayElementMatchesRow() throws JSONException {
     JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);
     Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator));
     JSONAssert.assertEquals("{a:[{type:row}]}", ARRAY_OF_JSONOBJECTS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here

Examples of org.skyscreamer.jsonassert.comparator.CustomComparator

 
  @Test
  public void verifyBackgroundAttributesOfEveryArrayElementAlternateBetweenWhiteAndGrey() throws JSONException {
     JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);
     Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator));
     JSONAssert.assertEquals("{a:[{background:white},{background:grey}]}", ARRAY_OF_JSONOBJECTS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here

Examples of org.skyscreamer.jsonassert.comparator.CustomComparator

 
  @Test
  public void verifyEveryElementOfArrayIsJSONArrayOfLength3() throws JSONException {
     JSONComparator comparator = new ArraySizeComparator(JSONCompareMode.STRICT_ORDER);
     Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator, 0, 2));
     JSONAssert.assertEquals("{a:[[3]]}", ARRAY_OF_JSONARRAYS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.