/*
 * Copyright 2016-2018 shardingsphere.io.
 * <p>
 * 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.
 * </p>
 */

package io.shardingsphere.spi;

import io.shardingsphere.spi.transaction.xa.DataSourceMapConverter;
import org.junit.Test;

import java.util.Collection;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public class NewInstanceServiceLoaderTest {
    
    @Test
    public void assertLoadService() {
        Collection<DataSourceMapConverter> collections = NewInstanceServiceLoader.load(DataSourceMapConverter.class);
        assertThat(collections.size(), is(1));
        assertThat(collections.iterator().next(), instanceOf(DataSourceMapConverter.class));
    }
}

@@ -724,24 +724,84 @@
 ort 
-org.junit.Test;%0A
+lombok.SneakyThrows;%0Aimport org.junit.Test;%0A%0Aimport java.lang.reflect.Field;
 %0Aimp
@@ -825,16 +825,38 @@
 lection;
+%0Aimport java.util.Map;
 %0A%0Aimport
@@ -1350,10 +1350,492 @@
 ;%0A    %7D%0A
+    %0A    @Test%0A    @SneakyThrows%0A    @SuppressWarnings(%22unchecked%22)%0A    public void assertRegisterService() %7B%0A        NewInstanceServiceLoader.register(DataSourceMapConverter.class);%0A        Field field = NewInstanceServiceLoader.class.getDeclaredField(%22SERVICE_MAP%22);%0A        field.setAccessible(true);%0A        Map%3CClass, Collection%3CClass%3C?%3E%3E%3E map = (Map%3CClass, Collection%3CClass%3C?%3E%3E%3E) field.get(null);%0A        assertThat(map.get(DataSourceMapConverter.class).size(), is(1));%0A    %7D%0A
 %7D%0A

Add NewInstanceServiceLoaderTest.assertRegisterService().