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 java.util.ArrayList;
17  import java.util.HashSet;
18  import java.util.List;
19  import java.util.Set;
20  
21  import org.junit.jupiter.api.Assertions;
22  import org.junit.jupiter.api.Test;
23  
24  public class CaseCombinatorTest {
25  
26      CaseCombinator p = new CaseCombinator();
27  
28      @Test
29      public void smoke() {
30          CaseCombinator p = new CaseCombinator();
31  
32          List<String> result = p.combinations("a-B=");
33  
34          List<String> witness = new ArrayList<String>();
35          witness.add("a-b=");
36          witness.add("A-b=");
37          witness.add("a-B=");
38          witness.add("A-B=");
39          Assertions.assertEquals(witness, result);
40      }
41  
42      @Test
43      public void other() {
44          List<String> result = p.combinations("aBCd");
45          Assertions.assertEquals(16, result.size());
46          Set<String> witness = new HashSet<String>(result);
47          // check that there are no duplicates
48          Assertions.assertEquals(16, witness.size());
49      }
50  }