@Test public void testIsMaskMatched() { assertTrue(IRC.isMaskMatched("*!*@host.fr", "123!456@*")); assertTrue(IRC.isMaskMatched("???*[email protected]", "[email protected]")); assertTrue(IRC.isMaskMatched("[email protected]", "*!*@host.fr")); assertTrue(!IRC.isMaskMatched("1?3!4?6@*.fr", "*!*@host.fr")); }
@Test public void testGetMask() { assertEquals(IRC.getMask("*"), "*!*@*"); assertEquals(IRC.getMask("abc"), "abc!*@*"); assertEquals(IRC.getMask("abc@def"), "abc!*@def"); assertEquals(IRC.getMask("abc?*@def"), "abc?*!*@def"); }
@Test public void testGetHostmaskFromTokens() { assertEquals(IRC.getHostmaskFromTokens("abc", "def", "ghi"), "abc!def@ghi"); assertEquals(IRC.getHostmaskFromTokens("abc", "def", "81.0.0.1"), "[email protected]"); assertEquals(IRC.getHostmaskFromTokens("#abc", "def", "ghi"), null); assertEquals(IRC.getHostmaskFromTokens("ab*c", "*", "*"), null); }
@Test public void testIsMaskValid() { assertTrue(IRC.isMaskValid("*!*@*")); assertTrue(IRC.isMaskValid("?!*@*")); assertTrue(IRC.isMaskValid("?!*@abc?de")); assertTrue(IRC.isMaskValid("?*@*")); }
@Test public void testIsNicknameValid() { assertTrue(IRC.isNicknameValid("a")); assertTrue(IRC.isNicknameValid("a0")); assertTrue(!IRC.isNicknameValid("0abc")); assertTrue(!IRC.isNicknameValid("-abc")); }
@Test public void testIsHostmaskValid() { assertTrue(IRC.isHostmaskValid("[email protected]")); assertTrue(!IRC.isHostmaskValid("[email protected]")); assertTrue(!IRC.isHostmaskValid("?!*@abc?de")); assertTrue(!IRC.isHostmaskValid("?*@*")); }
@Test public void testIsSafeChannelNameValid() { assertTrue(IRC.isSafeChannelNameValid("!abc")); assertTrue(IRC.isSafeChannelNameValid("!#abc")); assertTrue(!IRC.isSafeChannelNameValid("#abc")); assertTrue(!IRC.isSafeChannelNameValid("+abc")); }
@Test public void testIsChannelNameValid() { assertTrue(IRC.isChannelNameValid("#abc")); assertTrue(IRC.isChannelNameValid("&abc")); assertTrue(IRC.isChannelNameValid("+abc")); assertTrue(IRC.isChannelNameValid("!abc")); }
@Test public void testGetMaskFromTokens() { assertEquals(IRC.getMaskFromTokens("?", "*", "*"), "?!*@*"); assertEquals(IRC.getMaskFromTokens("*", "*", "81.0.0.1"), "*!*@81.0.0.1"); assertEquals(IRC.getMaskFromTokens("@bc", "*", "*"), null); assertEquals(IRC.getMaskFromTokens("abc", "abc!def", "*"), "abc!abc!def@*"); }
@Test public void testGetMaskTokens() { String[] tokens; tokens = IRC.getMaskTokens("a?c"); assertEquals(tokens[0], "a?c"); assertEquals(tokens[1], "*"); assertEquals(tokens[2], "*"); tokens = IRC.getMaskTokens("[email protected]"); assertEquals(tokens[0], "a"); assertEquals(tokens[1], "*"); assertEquals(tokens[2], "81.0.0.1"); }
@Test public void testGenerateSafeChannelID() { assertTrue(!IRC.generateSafeChannelID().contains("abcdefghijklmnopqrstuvwxyz")); }