1 28 29 package com.idaremedia.antx.flowcontrol.tests; 30 31 import junit.framework.TestSuite; 32 33 import com.idaremedia.antx.ut.HTC; 34 import com.idaremedia.antx.ut.HTCUtils; 35 36 46 47 public final class SwitchTaskTest extends HTC 48 { 49 50 public static final String TEST_CATEGORY="CLASS"; 51 52 53 56 public SwitchTaskTest(String methodName) 57 { 58 super("SwitchTask::",methodName); 59 } 60 61 62 65 public static TestSuite suite() 66 { 67 return new TestSuite(SwitchTaskTest.class); 68 } 69 70 71 74 public static TestSuite baseline() 75 { 76 return suite(); } 78 79 80 83 public static void main(String [] argv) 84 { 85 HTCUtils.quickCheck(suite()); 86 } 87 88 89 93 protected void setUp() throws Exception 94 { 95 configureProjectFromResource("switch.xml"); 96 } 97 98 102 public void checkBaseline() 103 { 104 } 106 107 public void testBaseline() 108 { 109 checkBaseline(); 110 } 111 112 public void testNoCasesOK() 113 { 114 runTarget("testEmptyOK"); 115 } 116 117 public void testEmptySwitchValueOK() 118 { 119 runTarget("testEmptySwitchValueOK"); 120 } 121 122 public void testHaltIfNoMatchByValue() 123 { 124 runTarget("testHaltIfNoMatchValue"); 125 } 126 127 public void testHaltIfNoMatchByProperty() 128 { 129 runTarget("testHaltIfNoMatchProperty"); 130 } 131 132 public void testNestEqualsFirstForcesOnlyEquals() 133 { 134 verifyCantLoadFile("broken_switch0.xml", "Mixing 'Equals' and 'Like' choices"); 135 } 136 137 public void testNestLikeFirstForcesOnlyLikes() 138 { 139 verifyCantLoadFile("broken_switch1.xml", "Mixing 'Equals' and 'Like' choices"); 140 } 141 142 public void testEqualsLikeRequireEnclosingMatch() 143 { 144 configureProjectFromResource("broken_switch2.xml"); 145 runExpecting("testBrokenXML_LikeEquals_OnlyIn_MatchTask1", 146 "'Equals' and 'Like' require enclosing 'Match'"); 147 runExpecting("testBrokenXML_LikeEquals_OnlyIn_MatchTask2", 148 "'Equals' and 'Like' require enclosing 'Match'"); 149 } 150 151 public void testDefaultAlwaysMatches() 152 { 153 String log = runTarget("testDefaultAlwaysMatches"); 154 assertTrue(log.indexOf("bingo")>=0,"Found correct match!"); 155 assertPropertyEquals("the.veggie", "default"); 156 } 157 158 public void testChoiceByProperties() 159 { 160 String log= runTarget("testChoiceByProperty"); 161 assertTrue(log.indexOf("bingo")>=0,"Found correct match!"); 162 } 163 164 public void testChoiceByAsIsValues() 165 { 166 String log= runTarget("testChoiceByValue"); 167 assertTrue(log.indexOf("bingo")>=0,"Found correct match!"); 168 } 169 170 public void testChoiceByOthers() 171 { 172 runTarget("testChoiceByOther"); 173 } 174 175 public void testMatchValueUsed() 176 { 177 runTarget("testMatchValueUsed"); 178 } 179 180 public void testLikeCombinations() 181 { 182 runTarget("testLikeCombinations"); 183 } 184 185 public void testMultipleMatchesHitsOnlyFirst() 186 { 187 runTarget("testMultipleMatchesHitsFirst"); 188 } 189 190 public void testChoiceByCondition_AntX05() 191 { 192 runTarget("testChoiceByCondition_AntX05"); 193 } 194 195 public void testTrueIfElsePresetdefWorks_AntX05() 196 { 197 runTarget("testTrueIfElsePresetdefWorks_AntX05"); 198 } 199 } 200 201 202 | Popular Tags |