View Javadoc
1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
4    *
5    * This program and the accompanying materials are dual-licensed under
6    * either the terms of the Eclipse Public License v1.0 as published by
7    * the Eclipse Foundation
8    *
9    *   or (per the licensee's choosing)
10   *
11   * under the terms of the GNU Lesser General Public License version 2.1
12   * as published by the Free Software Foundation.
13   */
14  package ch.qos.logback.core.joran.spi;
15  
16  import static org.junit.Assert.assertEquals;
17  
18  import java.util.ArrayList;
19  import java.util.HashSet;
20  import java.util.List;
21  import java.util.Set;
22  
23  import org.junit.Test;
24  
25  public class CaseCombinatorTest {
26  
27      CaseCombinator p = new CaseCombinator();
28  
29      @Test
30      public void smoke() {
31          CaseCombinator p = new CaseCombinator();
32  
33          List<String> result = p.combinations("a-B=");
34  
35          List<String> witness = new ArrayList<String>();
36          witness.add("a-b=");
37          witness.add("A-b=");
38          witness.add("a-B=");
39          witness.add("A-B=");
40          assertEquals(witness, result);
41      }
42  
43      @Test
44      public void other() {
45          List<String> result = p.combinations("aBCd");
46          assertEquals(16, result.size());
47          Set<String> witness = new HashSet<String>(result);
48          // check that there are no duplicates
49          assertEquals(16, witness.size());
50      }
51  }