The StorageBackendException is catched two times so that the user see the "500 internal server error" only at the second catch (probably fixes #5).
3 * see AUTHORS for the list of contributors
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 package test.util.mlgw;
21 import java.lang.reflect.InvocationTargetException;
22 import java.lang.reflect.Method;
23 import junit.framework.TestCase;
24 import org.sonews.mlgw.Dispatcher;
27 * Tests the methods of class org.sonews.mlgw.Dispatcher.
28 * @author Christian Lins
31 public class DispatcherTest extends TestCase
34 public DispatcherTest()
36 super("DispatcherTest");
39 public void testChunkListPost()
40 throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
42 Dispatcher disp = new Dispatcher();
44 Class clazz = disp.getClass();
45 Method methChunkListPost = clazz.getDeclaredMethod("chunkListPost", String.class);
46 methChunkListPost.setAccessible(true);
50 // disp.chunkListPost(null)
51 methChunkListPost.invoke(disp, null);
52 fail("Should have raised an IllegalArgumentException");
54 catch(IllegalArgumentException ex){}
56 // disp.chunkListPost("")
57 Object obj = methChunkListPost.invoke(disp, "");
60 // disp.chunkListPost("listPostValue is of form <mailto:dev@openoffice.org>")
61 obj = methChunkListPost.invoke(disp, "listPostValue is of form <mailto:dev@openoffice.org>");
63 assertEquals("dev@openoffice.org", (String)obj);
65 // disp.chunkListPost("<mailto:frisbee-users@fun.rec.uk.sun.com")
66 obj = methChunkListPost.invoke(disp, "<mailto:frisbee-users@fun.rec.uk.sun.com");
68 assertEquals("frisbee-users@fun.rec.uk.sun.com", (String)obj);