You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IRCParserTest.java 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * ServerManagerTest.java
  3. * JUnit 4.x based test
  4. *
  5. */
  6. package com.dmdirc.parser;
  7. import com.dmdirc.parser.callbacks.CallbackNotFound;
  8. import com.dmdirc.parser.callbacks.interfaces.IAwayState;
  9. import junit.framework.TestCase;
  10. import org.junit.Test;
  11. import static org.junit.Assert.*;
  12. /**
  13. *
  14. * @author Chris
  15. */
  16. public class IRCParserTest extends TestCase {
  17. public IRCParserTest() {
  18. }
  19. @Test
  20. public void testIssue042() {
  21. boolean res = false;
  22. try {
  23. final IRCParser myParser = new IRCParser();
  24. myParser.getCallbackManager().addCallback("non-existant",new IAwayState() {
  25. public void onAwayState(IRCParser tParser, boolean currentState, String reason) {
  26. throw new UnsupportedOperationException("Not supported yet.");
  27. }
  28. });
  29. } catch (CallbackNotFound ex) {
  30. res = true;
  31. }
  32. assertTrue("addCallback() should throw exception for non-existant callbacks", res);
  33. }
  34. }