1002N/A/*
1002N/A * CDDL HEADER START
1002N/A *
1002N/A * The contents of this file are subject to the terms of the
1002N/A * Common Development and Distribution License (the "License").
1002N/A * You may not use this file except in compliance with the License.
1002N/A *
1002N/A * See LICENSE.txt included in this distribution for the specific
1002N/A * language governing permissions and limitations under the License.
1002N/A *
1002N/A * When distributing Covered Code, include this CDDL HEADER in each
1002N/A * file and include the License file at LICENSE.txt.
1002N/A * If applicable, add the following below this CDDL HEADER, with the
1002N/A * fields enclosed by brackets "[]" replaced with your own identifying
1002N/A * information: Portions Copyright [yyyy] [name of copyright owner]
1002N/A *
1002N/A * CDDL HEADER END
1002N/A */
1002N/A
1002N/A/*
1138N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
1002N/A */
1002N/A
1002N/Apackage org.opensolaris.opengrok.search.context;
1002N/A
1002N/Aimport org.junit.Test;
1002N/Aimport static org.junit.Assert.*;
1002N/A
1002N/A/**
1002N/A * Tests for the WildCardMatcher class.
1002N/A */
1002N/Apublic class WildCardMatcherTest {
1002N/A
1002N/A /**
1002N/A * Test of match method.
1002N/A */
1002N/A @Test
1002N/A public void testMatch() {
1138N/A WildCardMatcher m = new WildCardMatcher("wild?ard", true); // bug #15644
1002N/A assertEquals(LineMatcher.MATCHED, m.match("wildcard"));
1002N/A assertEquals(LineMatcher.MATCHED, m.match("wildward"));
1002N/A assertEquals(LineMatcher.MATCHED, m.match("wilddard"));
1002N/A assertEquals(LineMatcher.MATCHED, m.match("wild?ard"));
1002N/A assertEquals(LineMatcher.NOT_MATCHED, m.match("wildard"));
1002N/A assertEquals(LineMatcher.NOT_MATCHED, m.match("wildcarde"));
1002N/A assertEquals(LineMatcher.NOT_MATCHED, m.match("awildcard"));
1002N/A assertEquals(LineMatcher.NOT_MATCHED, m.match("wildddard"));
1002N/A assertEquals(LineMatcher.NOT_MATCHED, m.match("mildcard"));
1002N/A assertEquals(LineMatcher.NOT_MATCHED, m.match("wildc?rd"));
1002N/A
1138N/A m = new WildCardMatcher("wild*ard", true);
1002N/A assertEquals(LineMatcher.MATCHED, m.match("wildcard"));
1002N/A assertEquals(LineMatcher.MATCHED, m.match("wildward"));
1002N/A assertEquals(LineMatcher.MATCHED, m.match("wilddard"));
1002N/A assertEquals(LineMatcher.MATCHED, m.match("wildard"));
1002N/A assertEquals(LineMatcher.MATCHED, m.match("wildxyzard"));
1002N/A assertEquals(LineMatcher.MATCHED, m.match("wildxyzard"));
1002N/A assertEquals(LineMatcher.NOT_MATCHED, m.match("wild"));
1002N/A assertEquals(LineMatcher.NOT_MATCHED, m.match("ard"));
1002N/A assertEquals(LineMatcher.NOT_MATCHED, m.match("wildcat"));
1002N/A assertEquals(LineMatcher.NOT_MATCHED, m.match("wildcarda"));
1002N/A assertEquals(LineMatcher.NOT_MATCHED, m.match("mildcard"));
1002N/A }
1002N/A
1002N/A}