001/*
002 * Copyright (c) 2012, 2013, Werner Keil, Credit Suisse (Anatole Tresch). Licensed under the Apache
003 * License, Version 2.0 (the "License"); you may not use this file except in compliance with the
004 * License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
005 * Unless required by applicable law or agreed to in writing, software distributed under the License
006 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
007 * or implied. See the License for the specific language governing permissions and limitations under
008 * the License. Contributors: Anatole Tresch - initial version.
009 */
010package org.javamoney.tck.tests;
011
012import org.javamoney.tck.TCKTestSetup;
013import org.jboss.test.audit.annotations.SpecAssertion;
014import org.jboss.test.audit.annotations.SpecVersion;
015import org.testng.AssertJUnit;
016import org.testng.annotations.Test;
017
018import java.util.Collection;
019
020@SpecVersion(spec = "JSR 354", version = "1.0.0")
021public class TCKSetupTest {
022
023    @SpecAssertion(
024            section = "0",
025            id = "Setup",
026            note = "Tests that a TestConfiguration is registered with the JDK's ServiceLoader.")
027    @Test(description = "TCK Setup: ensure TCK Configuration is registered and available.")
028    public void testTestSetup() {
029        AssertJUnit.assertTrue("TCK Configuration not available.", TCKTestSetup.getTestConfiguration() != null);
030        AssertJUnit.assertNotNull(TCKTestSetup.getTestConfiguration());
031    }
032
033    @SpecAssertion(
034            section = "0",
035            id = "Setup",
036            note = "Checks that TestConfiguration.getAmountClasses() returns a non empty collection of amount " +
037                    "implementations")
038    @Test(description = "TChecks that MonetaryAmount classes are registered for testing.")
039    public void testTestAmountConfiguration() {
040        Collection<Class> amountClasses = TCKTestSetup.getTestConfiguration().getAmountClasses();
041        AssertJUnit.assertNotNull("TCK Test Configuration amount classes are null.", amountClasses);
042        AssertJUnit.assertFalse("TCK Test Configuration amount classes is empty.", amountClasses.isEmpty());
043    }
044
045
046}