cli@12: /*
cli@12: * SONEWS News Server
cli@12: * see AUTHORS for the list of contributors
cli@12: *
cli@12: * This program is free software: you can redistribute it and/or modify
cli@12: * it under the terms of the GNU General Public License as published by
cli@12: * the Free Software Foundation, either version 3 of the License, or
cli@12: * (at your option) any later version.
cli@12: *
cli@12: * This program is distributed in the hope that it will be useful,
cli@12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
cli@12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cli@12: * GNU General Public License for more details.
cli@12: *
cli@12: * You should have received a copy of the GNU General Public License
cli@12: * along with this program. If not, see .
cli@12: */
cli@12:
cli@12: package test.util.mlgw;
cli@12:
cli@12: import java.lang.reflect.InvocationTargetException;
cli@12: import java.lang.reflect.Method;
cli@12: import junit.framework.TestCase;
cli@12: import org.sonews.mlgw.Dispatcher;
cli@12:
cli@12: /**
cli@12: * Tests the methods of class org.sonews.mlgw.Dispatcher.
cli@12: * @author Christian Lins
cli@12: * @since sonews/1.0.3
cli@12: */
cli@12: public class DispatcherTest extends TestCase
cli@12: {
cli@12:
cli@12: public DispatcherTest()
cli@12: {
cli@12: super("DispatcherTest");
cli@12: }
cli@12:
cli@12: public void testChunkListPost()
cli@12: throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
cli@12: {
cli@12: Dispatcher disp = new Dispatcher();
cli@12:
cli@12: Class clazz = disp.getClass();
cli@12: Method methChunkListPost = clazz.getDeclaredMethod("chunkListPost", String.class);
cli@12: methChunkListPost.setAccessible(true);
cli@12:
cli@12: try
cli@12: {
cli@12: // disp.chunkListPost(null)
cli@12: methChunkListPost.invoke(disp, null);
cli@12: fail("Should have raised an IllegalArgumentException");
cli@12: }
cli@12: catch(IllegalArgumentException ex){}
cli@12:
cli@12: // disp.chunkListPost("")
cli@12: Object obj = methChunkListPost.invoke(disp, "");
cli@12: assertNull(obj);
cli@12:
cli@12: // disp.chunkListPost("listPostValue is of form ")
cli@12: obj = methChunkListPost.invoke(disp, "listPostValue is of form ");
cli@12: assertNotNull(obj);
cli@12: assertEquals("dev@openoffice.org", (String)obj);
cli@12:
cli@12: // disp.chunkListPost("