/*
 * Copyright (c) 2018 by Oliver Boehm
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * (c)reated 08.08.2018 by oboehm (ob@oasd.de)
 */
package de.jfachwert.bank.internal;

import org.junit.Test;

import javax.money.CurrencyQuery;
import javax.money.CurrencyQueryBuilder;
import javax.money.CurrencyUnit;
import java.util.List;
import java.util.Locale;
import java.util.Set;

import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.*;

/**
 * Unit-Tests fuer {@link WaehrungenSingleton}-Klasse.
 *
 * @author oboehm
 */
public final class WaehrungenSingletonTest {
    
    private final WaehrungenSingleton singleton = new WaehrungenSingleton();

    @Test
    public void testGetDefaultProviderChain() {
        List<String> providerChain = singleton.getDefaultProviderChain();
        assertThat(providerChain, not(empty()));
    }

    @Test
    public void getProviderNames() {
        Set<String> providerNames = singleton.getProviderNames();
        assertThat(providerNames, not(empty()));
    }

    @Test
    public void getCurrencies() {
        CurrencyQuery query = CurrencyQueryBuilder.of().setCountries(Locale.GERMANY).build();
        Set<CurrencyUnit> currencies = singleton.getCurrencies(query);
        assertThat(currencies, not(empty()));
    }

    @Test
    public void getCurrenciesUnknown() {
        CurrencyQuery query = CurrencyQueryBuilder.of().setCurrencyCodes("SDR").build();
        Set<CurrencyUnit> currencies = singleton.getCurrencies(query);
        assertThat(currencies, empty());
    }

}

@@ -703,16 +703,70 @@
 it.Test;
+%0Aimport patterntesting.runtime.junit.CollectionTester;
 %0A%0Aimport
@@ -867,16 +867,120 @@
 cyUnit;%0A
+import javax.money.spi.Bootstrap;%0Aimport javax.money.spi.CurrencyProviderSpi;%0Aimport java.util.HashSet;%0A
 import j
@@ -1157,17 +1157,26 @@
 .Assert.
-*
+assertThat
 ;%0A%0A/**%0A 
@@ -2133,32 +2133,316 @@
 %22SDR%22).build();%0A
+        Set%3CCurrencyUnit%3E expected = new HashSet%3C%3E();%0A        for (CurrencyProviderSpi spi : Bootstrap.getServices(CurrencyProviderSpi.class)) %7B%0A            if (!(spi instanceof WaehrungenProvider)) %7B%0A                expected.addAll(spi.getCurrencies(query));%0A            %7D%0A        %7D%0A
         Set%3CCurr
@@ -2500,35 +2500,64 @@
 y);%0A        
-assertThat(
+CollectionTester.assertEquals(expected, 
 currencies, 
@@ -2558,17 +2558,8 @@
 cies
-, empty()
 );%0A 

Test stabilisiert