1 20 package org.apache.cactus; 21 22 import junit.framework.TestCase; 23 import org.apache.cactus.internal.AbstractCactusTestCase; 24 import org.apache.cactus.internal.client.connector.http.HttpProtocolHandler; 25 import org.apache.cactus.internal.configuration.BaseConfiguration; 26 import org.apache.cactus.internal.configuration.DefaultServletConfiguration; 27 import org.apache.cactus.internal.util.TestCaseImplementError; 28 import org.apache.cactus.spi.client.connector.ProtocolHandler; 29 30 35 public class TestNoNameTestCase extends TestCase 36 { 37 41 class NoNameTestCase extends AbstractCactusTestCase 42 { 43 46 public NoNameTestCase() 47 { 48 } 49 50 54 public NoNameTestCase(String theName) 55 { 56 } 57 58 62 public void setName(String theName) 63 { 64 } 65 66 70 protected ProtocolHandler createProtocolHandler() 71 { 72 return new HttpProtocolHandler(new DefaultServletConfiguration()); 73 } 74 75 78 public void testNoName() 79 { 80 } 81 } 82 83 87 class NoNameServletTestCase extends ServletTestCase 88 { 89 92 public NoNameServletTestCase() 93 { 94 } 95 96 100 public NoNameServletTestCase(String theName) 101 { 102 } 103 104 108 public void setName(String theName) 109 { 110 } 111 112 115 public void testNoName() 116 { 117 } 118 } 119 120 124 class NoNameJspTestCase extends JspTestCase 125 { 126 129 public NoNameJspTestCase() 130 { 131 } 132 133 137 public NoNameJspTestCase(String theName) 138 { 139 } 140 141 145 public void setName(String theName) 146 { 147 } 148 149 152 public void testNoName() 153 { 154 } 155 } 156 157 160 public void setUp() 161 { 162 System.setProperty(BaseConfiguration.CACTUS_CONTEXT_URL_PROPERTY, 163 "http://localhost/dummy"); 164 } 165 166 169 public TestNoNameTestCase(String theName) 170 { 171 super(theName); 172 } 173 174 177 private void executeRunBare(TestCase theTest) 178 { 179 try 180 { 181 theTest.runBare(); 182 fail("test should fail"); 183 } 184 catch (Throwable t) 185 { 186 assertEquals(TestCaseImplementError.class.getName(), 187 t.getClass().getName()); 188 String message = t.getMessage(); 189 assertNotNull("no message", message); 190 assertEquals("No test name found. " 191 + "The test [" + theTest.getClass().getName() 192 + "] is not properly implemented.", message); 193 } 194 } 195 196 200 public void testNoNameTestCase() 201 { 202 TestCase test; 203 test = new NoNameTestCase("testNoName"); 204 executeRunBare(test); 205 } 206 207 211 public void testNoNameTestCaseWithSetName() 212 { 213 TestCase test; 214 test = new NoNameTestCase(); 215 test.setName("testNoName"); 216 executeRunBare(test); 217 } 218 219 223 public void testNoNameServletTestCase() 224 { 225 TestCase test; 226 test = new NoNameServletTestCase("testNoName"); 227 executeRunBare(test); 228 } 229 230 234 public void testNoNameServletTestCaseWithSetName() 235 { 236 TestCase test; 237 test = new NoNameServletTestCase(); 238 test.setName("testNoName"); 239 executeRunBare(test); 240 } 241 242 246 public void testNoNameJspTestCase() 247 { 248 TestCase test; 249 test = new NoNameJspTestCase("testNoName"); 250 executeRunBare(test); 251 } 252 253 257 public void testNoNameJspTestCaseWithSetName() 258 { 259 TestCase test; 260 test = new NoNameJspTestCase(); 261 test.setName("testNoName"); 262 executeRunBare(test); 263 } 264 } 265 | Popular Tags |