3 * Copyright (C) 2009-2016 SonarSource SA
4 * mailto:contact AT sonarsource DOT com
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 package org.sonar.server.component.index;
22 import org.junit.Test;
24 public class ComponentIndexMultipleWordsTest extends ComponentIndexTest {
27 public void should_find_perfect_match() {
28 assertResultOrder("struts java",
33 public void should_find_fuzzy_match() {
34 features.set(ComponentIndexSearchFeature.FUZZY);
35 assertResultOrder("StrutX ProjecX",
40 public void should_find_partial_match() {
41 features.set(ComponentIndexSearchFeature.PARTIAL);
42 assertResultOrder("struts java",
47 public void should_find_partial_match_prefix_word1() {
48 assertResultOrder("struts java",
53 public void should_find_partial_match_suffix_word1() {
54 assertResultOrder("struts java",
59 public void should_find_partial_match_prefix_word2() {
60 assertResultOrder("struts java",
65 public void should_find_partial_match_suffix_word2() {
66 assertResultOrder("struts java",
71 public void should_find_partial_match_prefix_and_suffix_everywhere() {
72 assertResultOrder("struts java",
73 "MyStrutsObject.xjavax");
77 public void should_find_subset_of_document_terms() {
78 assertResultOrder("struts java",
79 "Some.Struts.Class.java.old");
83 public void should_require_all_words_to_match() {
84 assertNoFileMatches("struts java",
89 public void should_ignore_empty_words() {
90 assertFileMatches(" : . struts \n . :\n\n",
95 public void should_require_all_words_to_match_for_fuzziness() {
96 features.set(ComponentIndexSearchFeature.FUZZY);
97 assertNoFileMatches("struts java",
102 public void should_require_all_words_to_match_for_partial() {
103 features.set(ComponentIndexSearchFeature.PARTIAL);
104 assertNoFileMatches("struts java",