|
1 | | -/* Copyright (c) 2000-2006 hamcrest.org |
| 1 | +/* Copyright (c) 2000-2009 hamcrest.org |
2 | 2 | */ |
3 | 3 | package org.hamcrest.core; |
4 | 4 |
|
| 5 | +import static org.hamcrest.Matchers.greaterThan; |
5 | 6 | import static org.hamcrest.core.IsEqual.equalTo; |
6 | 7 | import static org.hamcrest.core.IsNot.not; |
7 | 8 |
|
8 | 9 | import org.hamcrest.AbstractMatcherTest; |
9 | 10 | import org.hamcrest.Matcher; |
10 | 11 |
|
11 | 12 | public class IsNotTest extends AbstractMatcherTest { |
12 | | - @Override |
13 | | - protected Matcher<?> createMatcher() { |
14 | | - return not("something"); |
15 | | - } |
| 13 | + @Override |
| 14 | + protected Matcher<?> createMatcher() { |
| 15 | + return not("something"); |
| 16 | + } |
16 | 17 |
|
17 | | - public void testEvaluatesToTheTheLogicalNegationOfAnotherMatcher() { |
18 | | - assertMatches("should match", not(equalTo("A")), "B"); |
19 | | - assertDoesNotMatch("should not match", not(equalTo("B")), "B"); |
20 | | - } |
| 18 | + public void testEvaluatesToTheTheLogicalNegationOfAnotherMatcher() { |
| 19 | + assertMatches("should match", not(equalTo("A")), "B"); |
| 20 | + assertDoesNotMatch("should not match", not(equalTo("B")), "B"); |
| 21 | + } |
21 | 22 |
|
22 | | - public void testProvidesConvenientShortcutForNotEqualTo() { |
23 | | - assertMatches("should match", not("A"), "B"); |
24 | | - assertMatches("should match", not("B"), "A"); |
25 | | - assertDoesNotMatch("should not match", not("A"), "A"); |
26 | | - assertDoesNotMatch("should not match", not("B"), "B"); |
27 | | - assertDescription("not \"A\"", not("A")); |
28 | | - } |
29 | | -} |
| 23 | + public void testProvidesConvenientShortcutForNotEqualTo() { |
| 24 | + assertMatches("should match", not("A"), "B"); |
| 25 | + assertMatches("should match", not("B"), "A"); |
| 26 | + assertDoesNotMatch("should not match", not("A"), "A"); |
| 27 | + assertDoesNotMatch("should not match", not("B"), "B"); |
| 28 | + } |
| 29 | + |
| 30 | + public void testUsesDescriptionOfNegatedMatcherWithPrefix() { |
| 31 | + assertDescription("not a value greater than <2>", not(greaterThan(2))); |
| 32 | + assertDescription("not \"A\"", not("A")); |
| 33 | + } |
| 34 | + } |
0 commit comments