Package com.base2art.jeqll.matchers

Source Code of com.base2art.jeqll.matchers.NotMatcherTest

package com.base2art.jeqll.matchers;

import com.base2art.jeqll.matchers.NotMatcher;
import com.base2art.jeqll.matchers.EqualityMatcher;
import com.base2art.jeqll.sampleData.TestObject;
import static org.fest.assertions.Assertions.*;
import org.junit.Test;

public class NotMatcherTest
{

  @Test
  public void shouldCompareCorrectly()
  {
    TestObject to = new TestObject("item1", 3);
    EqualityMatcher<TestObject, String> stringMatcher = new EqualityMatcher<>("name", "item1");
    EqualityMatcher<TestObject, Integer> intMatcher = new EqualityMatcher<>("index", 3);
    assertThat(new NotMatcher(stringMatcher).isMatch(to, 0)).isEqualTo(false);
    assertThat(new NotMatcher(intMatcher).isMatch(to, 0)).isEqualTo(false);

    stringMatcher = new EqualityMatcher<>("name", "item2");
    intMatcher = new EqualityMatcher<>("index", 2);
    assertThat(new NotMatcher(stringMatcher).isMatch(to, 0)).isEqualTo(true);
    assertThat(new NotMatcher(intMatcher).isMatch(to, 0)).isEqualTo(true);
  }
}
TOP

Related Classes of com.base2art.jeqll.matchers.NotMatcherTest

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.