PageRenderTime 23ms CodeModel.GetById 15ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/testability-explorer/src/test/java/com/google/test/metric/RegExpWhiteListTest.java

http://testability-explorer.googlecode.com/
Java | 31 lines | 24 code | 7 blank | 0 comment | 0 complexity | d1bfa931b54f2ac8fa3b4edad95a8047 MD5 | raw file
 1package com.google.test.metric;
 2
 3import junit.framework.TestCase;
 4
 5public class RegExpWhiteListTest extends TestCase {
 6
 7  public void testPositiveHitInWhiteList() throws Exception {
 8    WhiteList whiteList = new RegExpWhiteList("java.");
 9    assertTrue(whiteList.isClassWhiteListed("java.lang.String"));
10    assertFalse(whiteList.isClassWhiteListed("com.company.String"));
11  }
12
13  public void testRegExp() throws Exception {
14    WhiteList whiteList = new RegExpWhiteList(".*String");
15    assertTrue(whiteList.isClassWhiteListed("java.lang.String"));
16    assertTrue(whiteList.isClassWhiteListed("com.company.String"));
17  }
18
19  public void testRegExp2() throws Exception {
20    WhiteList whiteList = new RegExpWhiteList("String");
21    assertFalse(whiteList.isClassWhiteListed("java.lang.String"));
22    assertFalse(whiteList.isClassWhiteListed("com.company.String"));
23  }
24
25  public void testNegativeWhitelist() throws Exception {
26    WhiteList whiteList = new RegExpWhiteList("!java.lang");
27    assertFalse(whiteList.isClassWhiteListed("java.lang.String"));
28    assertTrue(whiteList.isClassWhiteListed("java.x.Z"));
29  }
30
31}