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; 011 012import java.util.ServiceLoader; 013 014public final class TCKTestSetup { 015 016 private static JSR354TestConfiguration TEST_CONFIG = loadTestConfiguration(); 017 018 private TCKTestSetup() { 019 } 020 021 private static JSR354TestConfiguration loadTestConfiguration() { 022 try { 023 return ServiceLoader.load(JSR354TestConfiguration.class).iterator() 024 .next(); 025 } catch (Exception e) { 026 throw new IllegalStateException("No valid implementation of " 027 + JSR354TestConfiguration.class.getName() 028 + " is registered with the ServiceLoader."); 029 } 030 } 031 032 public static JSR354TestConfiguration getTestConfiguration() { 033 return TEST_CONFIG; 034 } 035 036}