Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
BanlistTestCase.java
Package: jforum-2.1.8-src.zip [view]
Upload User: gdxydsw
Upload Date: 2019-01-29
Package Size: 16721k
Code Size: 2k
Category:
Java Develop
Development Platform:
Java
- package net.jforum.entities;
- import junit.framework.Assert;
- import junit.framework.TestCase;
- /**
- * @author Rafael Steil
- * @version $Id: BanlistTestCase.java,v 1.1 2006/12/12 00:44:50 rafaelsteil Exp $
- */
- public class BanlistTestCase extends TestCase {
- public void testMatchIpUsingOnlyStarsExpectsFalse() {
- Banlist b = this.newBanlist(0, null, "*.*.*.*");
- Assert.assertFalse(b.matches(this.newBanlist(0, null, "172.55.7.2")));
- }
- public void testMatchIpUsingStarExpectsTrue2() {
- Banlist b = this.newBanlist(0, null, "172.*.7.2");
- Assert.assertTrue(b.matches(this.newBanlist(0, null, "172.55.7.2")));
- }
- public void testMatchIpUsingStarExpectsTrue() {
- Banlist b = this.newBanlist(0, null, "*.168.7.*");
- Assert.assertTrue(b.matches(this.newBanlist(0, null, "172.168.7.2")));
- }
- public void testMatchIpUsingStarExpectsFalse2() {
- Banlist b = this.newBanlist(0, null, "*.168.7.*");
- Assert.assertFalse(b.matches(this.newBanlist(0, null, "172.168.1.2")));
- }
- public void testMatchIpUsingStarExpectsFalse() {
- Banlist b = this.newBanlist(0, null, "192.168.7.*");
- Assert.assertFalse(b.matches(this.newBanlist(0, null, "192.168.1.2")));
- }
- public void testMatchIpUsingDifferentLengthExpectsFalse() {
- Banlist b = this.newBanlist(0, null, "192.168.7");
- Assert.assertFalse(b.matches(this.newBanlist(0, null, "192.168.1.2")));
- }
- public void testMatchIpExpectsTrue() {
- Banlist b = this.newBanlist(0, "email@3", "192.168.1.1");
- Assert.assertTrue(b.matches(this.newBanlist(0, "email@2", "192.168.1.1")));
- }
- public void testMatchIpExpectsFalse() {
- Banlist b = this.newBanlist(0, null, "192.168.1.1");
- Assert.assertFalse(b.matches(this.newBanlist(0, null, "192.168.1.2")));
- }
- public void testMatchEmailExpectsTrue() {
- Banlist b = this.newBanlist(0, "email@2", null);
- Assert.assertTrue(b.matches(this.newBanlist(0, "email@2", null)));
- }
- public void testMatchEmailExpectsFalse() {
- Banlist b = this.newBanlist(0, "email@1", null);
- Assert.assertFalse(b.matches(this.newBanlist(0, "email@2", null)));
- }
- public void testMatchUserIdExpectsTrue() {
- Banlist b = this.newBanlist(2, null, null);
- Assert.assertTrue(b.matches(this.newBanlist(2, null, null)));
- }
- public void testMatchUserIdExpectsFalse() {
- Banlist b = this.newBanlist(1, null, null);
- Assert.assertFalse(b.matches(this.newBanlist(2, null, null)));
- }
- private Banlist newBanlist(int userId, String email, String ip) {
- Banlist b = new Banlist();
- b.setUserId(userId);
- b.setEmail(email);
- b.setIp(ip);
- return b;
- }
- }