1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
| package me.rkaehdaos;
import junit.framework.TestCase;
public class ComparisonCompactorTest extends TestCase {
public void testMessage() { String failure = new ComparisonCompactor(0, "b", "c").compact("a"); assertTrue("a expected:<[b]> but was:<[c]>".equals(failure)); }
public void testStartSame() { String failure = new ComparisonCompactor(1, "ba", "bc").compact(null); assertEquals("expected:<b[a]> but was:<b[c]>", failure); }
public void testEndSame() { String failure = new ComparisonCompactor(1, "ab", "cb").compact(null); assertEquals("expected:<[a]b> but was:<[c]b>", failure); }
public void testSame() { String failure = new ComparisonCompactor(1, "ab", "ab").compact(null); assertEquals("expected:<ab> but was:<ab>", failure); }
public void testNoContextStartAndEndSame() { String failure = new ComparisonCompactor(0, "abc", "adc").compact(null); assertEquals("expected:<...[b]...> but was:<...[d]...>", failure); }
public void testStartAndEndContext() { String failure = new ComparisonCompactor(1, "abc", "adc").compact(null); assertEquals("expected:<a[b]c> but was:<a[d]c>", failure); }
public void testStartAndEndContextWithEllipses() { String failure = new ComparisonCompactor(1, "abcde", "abfde").compact(null); assertEquals("expected:<...b[c]d...> but was:<...b[f]d...>", failure); }
public void testComparisonErrorStartSameComplete() { String failure = new ComparisonCompactor(2, "ab", "abc").compact(null); assertEquals("expected:<ab[]> but was:<ab[c]>", failure); }
public void testComparisonErrorEndSameComplete() { String failure = new ComparisonCompactor(0, "bc", "abc").compact(null); assertEquals("expected:<[]...> but was:<[a]...>", failure); }
public void testComparisonErrorEndSameCompleteContext() { String failure = new ComparisonCompactor(2, "bc", "abc").compact(null); assertEquals("expected:<[]bc> but was:<[a]bc>", failure); }
public void testComparisonErrorOverlappingMatches() { String failure = new ComparisonCompactor(0, "abc", "abbc").compact(null); assertEquals("expected:<...[]...> but was:<...[b]...>", failure); }
public void testComparisonErrorOverlappingMatchesContext() { String failure = new ComparisonCompactor(2, "abc", "abbc").compact(null); assertEquals("expected:<ab[]c> but was:<ab[b]c>", failure); }
public void testComparisonErrorOverlappingMatches2() { String failure = new ComparisonCompactor(0, "abcdde", "abcde").compact(null); assertEquals("expected:<...[d]...> but was:<...[]...>", failure); }
public void testComparisonErrorOverlappingMatches2Context() { String failure = new ComparisonCompactor(2, "abcdde", "abcde").compact(null); assertEquals("expected:<...cd[d]e> but was:<...cd[]e>", failure); }
public void testComparisonErrorWithActualNull() { String failure = new ComparisonCompactor(0, "a", null).compact(null); assertEquals("expected:<a> but was:<null>", failure); }
public void testComparisonErrorWithActualNullContext() { String failure = new ComparisonCompactor(2, "a", null).compact(null); assertEquals("expected:<a> but was:<null>", failure); }
public void testComparisonErrorWithExpectedNull() { String failure = new ComparisonCompactor(0, null, "a").compact(null); assertEquals("expected:<null> but was:<a>", failure); }
public void testComparisonErrorWithExpectedNullContext() { String failure = new ComparisonCompactor(2, null, "a").compact(null); assertEquals("expected:<null> but was:<a>", failure); }
public void testBug609972() { String failure = new ComparisonCompactor(10, "S&P500", "0").compact(null); assertEquals("expected:<[S&P50]0> but was:<[]0>", failure); } }
|