001/**
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v1.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014package ch.qos.logback.core.joran.spi;
015
016import static org.junit.Assert.assertEquals;
017
018import java.util.ArrayList;
019import java.util.HashSet;
020import java.util.List;
021import java.util.Set;
022
023import org.junit.Test;
024
025public class CaseCombinatorTest {
026
027    CaseCombinator p = new CaseCombinator();
028
029    @Test
030    public void smoke() {
031        CaseCombinator p = new CaseCombinator();
032
033        List<String> result = p.combinations("a-B=");
034
035        List<String> witness = new ArrayList<String>();
036        witness.add("a-b=");
037        witness.add("A-b=");
038        witness.add("a-B=");
039        witness.add("A-B=");
040        assertEquals(witness, result);
041    }
042
043    @Test
044    public void other() {
045        List<String> result = p.combinations("aBCd");
046        assertEquals(16, result.size());
047        Set<String> witness = new HashSet<String>(result);
048        // check that there are no duplicates
049        assertEquals(16, witness.size());
050    }
051}