123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- /*
- * Copyright (c) 2006-2008 Chris Smith, Shane Mc Cormack, Gregory Holmes
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
- package com.dmdirc.parser;
-
- import org.junit.Test;
- import static org.junit.Assert.*;
-
- public class NullCallbacksTest extends junit.framework.TestCase {
-
- private IRCProcessor getProcessor(String callback, String param) {
- final TestParser parser = new TestParser();
-
- parser.getCallbackManager().delCallbackType(
- parser.getCallbackManager().getCallbackType(callback));
-
- try {
- return parser.getProcessingManager().getProcessor(param);
- } catch (ProcessorNotFoundException ex) {
- assertFalse(true);
- return null;
- }
- }
-
- @Test
- public void testProcess001() {
- boolean exception = false;
-
- try {
- ((Process001) getProcessor("OnServerReady", "001")).callServerReady();
- } catch (Throwable ex) {
- exception = true;
- }
-
- assertFalse(exception);
- }
-
- @Test
- public void testProcess004005() {
- boolean exception = false;
-
- try {
- ((Process004005) getProcessor("OnGotNetwork", "004")).callGotNetwork();
- } catch (Throwable ex) {
- exception = true;
- }
-
- assertFalse(exception);
- }
-
- @Test
- public void testProcess464() {
- boolean exception = false;
-
- try {
- ((Process464) getProcessor("OnPasswordRequired", "464")).callPasswordRequired();
- } catch (Throwable ex) {
- exception = true;
- }
-
- assertFalse(exception);
- }
-
- @Test
- public void testProcessAway() {
- boolean exception = false;
-
- try {
- ((ProcessAway) getProcessor("OnAwayState", "301")).callAwayState(false, "");
- } catch (Throwable ex) {
- exception = true;
- }
-
- assertFalse(exception);
- }
-
- @Test
- public void testProcessInvite() {
- boolean exception = false;
-
- try {
- ((ProcessInvite) getProcessor("OnInvite", "INVITE")).callInvite("", "");
- } catch (Throwable ex) {
- exception = true;
- }
-
- assertFalse(exception);
- }
-
- @Test
- public void testProcessJoin() {
- boolean exception = false;
-
- try {
- ((ProcessJoin) getProcessor("OnChannelJoin", "JOIN")).callChannelJoin(null, null);
- ((ProcessJoin) getProcessor("OnChannelSelfJoin", "JOIN")).callChannelSelfJoin(null);
- } catch (Throwable ex) {
- exception = true;
- }
-
- assertFalse(exception);
- }
-
- @Test
- public void testProcessKick() {
- boolean exception = false;
-
- try {
- ((ProcessKick) getProcessor("OnChannelKick", "KICK")).callChannelKick(null,
- null, null, null, null);
- } catch (Throwable ex) {
- exception = true;
- }
-
- assertFalse(exception);
- }
-
- @Test
- public void testProcessListModes() {
- boolean exception = false;
-
- try {
- ((ProcessListModes) getProcessor("OnChannelGotListModes", "346"))
- .callChannelGotListModes(null);
- } catch (Throwable ex) {
- exception = true;
- }
-
- assertFalse(exception);
- }
-
- @Test
- public void testProcessMOTD() {
- boolean exception = false;
-
- try {
- ((ProcessMOTD) getProcessor("OnMOTDStart", "372")).callMOTDStart(null);
- ((ProcessMOTD) getProcessor("OnMOTDLine", "372")).callMOTDLine(null);
- ((ProcessMOTD) getProcessor("OnMOTDEnd", "372")).callMOTDEnd(false, null);
- } catch (Throwable ex) {
- exception = true;
- }
-
- assertFalse(exception);
- }
-
- }
|