1.1 --- a/logger/uihandlerserver/test/org/netbeans/server/componentsmatch/MatcherTest.java Wed Aug 29 13:42:12 2007 +0000
1.2 +++ b/logger/uihandlerserver/test/org/netbeans/server/componentsmatch/MatcherTest.java Tue Nov 20 18:46:51 2007 +0000
1.3 @@ -1,23 +1,25 @@
1.4
1.5 package org.netbeans.server.componentsmatch;
1.6
1.7 -import org.netbeans.server.componentsmatch.Package;
1.8 import java.io.IOException;
1.9 import java.io.InputStreamReader;
1.10 -import junit.framework.TestCase;
1.11 +import java.io.StringReader;
1.12 +import org.netbeans.modules.exceptions.entity.InnocentClass;
1.13 +import org.netbeans.server.uihandler.DatabaseTestCase;
1.14
1.15 /**
1.16 *
1.17 * @author pzajac
1.18 */
1.19 -public class MatcherTest extends TestCase{
1.20 +public class MatcherTest extends DatabaseTestCase{
1.21
1.22 /** Creates a new instance of MatcherTest */
1.23 public MatcherTest(String name) {
1.24 super(name);
1.25 }
1.26
1.27 - public void testSimple() {
1.28 + public void testSimple() throws IOException {
1.29 + Matcher.read(new StringReader(""));//clean Matcher
1.30 Package fsPack = new Package("org.openide.filesystems");
1.31 Component fsComp = new Component("openide","filesystems",4);
1.32 Component openideCodeComp = new Component("openide","code",2);
1.33 @@ -137,4 +139,40 @@
1.34 assertFalse("core".equals(comp.getComponent()));
1.35 }
1.36
1.37 + public void testInnocent() throws IOException{
1.38 + Matcher.read(new InputStreamReader (Matcher.class.getResourceAsStream("componentmapping.txt")));
1.39 + Matcher matcher = Matcher.getDefault();
1.40 +
1.41 + Component comp = matcher.match(new StackTraceElement[] {
1.42 + new StackTraceElement("org.openide.util.lookup.InstanceContent$SimpleItem","<init>","file",45)
1.43 + });
1.44 + assertNotNull(comp);//no Innocent
1.45 +
1.46 + comp = matcher.match(new StackTraceElement[] {
1.47 + new StackTraceElement("org.openide.util.lookup.SimpleLookup","<init>","file",45)
1.48 + });
1.49 + assertNotNull(comp);//no Innocent
1.50 +
1.51 + perUtils.persist(new InnocentClass("org.openide.util.lookup")); // look up is innocent
1.52 +
1.53 + comp = matcher.match(new StackTraceElement[] {
1.54 + new StackTraceElement("org.openide.util.lookup.InstanceContent$SimpleItem","<init>","file",45)
1.55 + });
1.56 + assertNull(comp);
1.57 +
1.58 + comp = matcher.match(new StackTraceElement[] {
1.59 + new StackTraceElement("org.openide.util.lookup.SimpleLookup","<init>","file",45)
1.60 + });
1.61 + assertNull(comp);
1.62 +
1.63 + comp = matcher.match(new StackTraceElement[] {
1.64 + new StackTraceElement("org.openide.util.lookup.Lookups","<init>","file",45)
1.65 + });
1.66 + assertNull(comp);
1.67 +
1.68 + comp = matcher.match(new StackTraceElement[] {
1.69 + new StackTraceElement("org.openide.util.Enumerations","<init>","file",45)
1.70 + });
1.71 + assertNotNull(comp);
1.72 + }
1.73 }