// Path: src/test/java/org/apache/commons/dbutils/handlers/columns/TestColumnHandler.java
// public class TestColumnHandler implements ColumnHandler {
// 
//     @Override
//     public boolean match(final Class<?> propType) {
//         return false;
//     }
// 
//     @Override
//     public Object apply(final ResultSet rs, final int columnIndex) throws SQLException {
//         return null;
//     }
// }
// 
// Path: src/test/java/org/apache/commons/dbutils/handlers/properties/TestPropertyHandler.java
// public class TestPropertyHandler implements PropertyHandler {
// 
//     @Override
//     public boolean match(final Class<?> parameter, final Object value) {
//         return false;
//     }
// 
//     @Override
//     public Object apply(final Class<?> parameter, final Object value) {
//         return null;
//     }
// }


import static org.junit.Assert.assertTrue;
import java.util.ServiceLoader;
import org.apache.commons.dbutils.handlers.columns.TestColumnHandler;
import org.apache.commons.dbutils.handlers.properties.TestPropertyHandler;
import org.junit.Before;
import org.junit.Test;
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */
package org.apache.commons.dbutils;




public class ServiceLoaderTest {
    private ServiceLoader<ColumnHandler> columns;
    private ServiceLoader<PropertyHandler> properties;

    @Before
    public void setUp() {
        columns = ServiceLoader.load(ColumnHandler.class);
        properties = ServiceLoader.load(PropertyHandler.class);
    }

    @Test
    public void testFindsLocalColumnHandler() {
        boolean found = false;
        for (final ColumnHandler handler : columns) {
            // this class is defined outside of the main classes in dbutils
            if (handler instanceof TestColumnHandler) {
                found = true;
            }
        }

        assertTrue(found);
    }

    @Test
    public void testFindsLocalPropertyHandler() {
        boolean found = false;
        for (final PropertyHandler handler : properties) {
            // this class is defined outside of the main classes in dbutils
// Path: src/test/java/org/apache/commons/dbutils/handlers/columns/TestColumnHandler.java
// public class TestColumnHandler implements ColumnHandler {
// 
//     @Override
//     public boolean match(final Class<?> propType) {
//         return false;
//     }
// 
//     @Override
//     public Object apply(final ResultSet rs, final int columnIndex) throws SQLException {
//         return null;
//     }
// }
// 
// Path: src/test/java/org/apache/commons/dbutils/handlers/properties/TestPropertyHandler.java
// public class TestPropertyHandler implements PropertyHandler {
// 
//     @Override
//     public boolean match(final Class<?> parameter, final Object value) {
//         return false;
//     }
// 
//     @Override
//     public Object apply(final Class<?> parameter, final Object value) {
//         return null;
//     }
// }


// Path: src/test/java/org/apache/commons/dbutils/ServiceLoaderTest.java
import static org.junit.Assert.assertTrue;
import java.util.ServiceLoader;
import org.apache.commons.dbutils.handlers.columns.TestColumnHandler;
import org.apache.commons.dbutils.handlers.properties.TestPropertyHandler;
import org.junit.Before;
import org.junit.Test;

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */
package org.apache.commons.dbutils;




public class ServiceLoaderTest {
    private ServiceLoader<ColumnHandler> columns;
    private ServiceLoader<PropertyHandler> properties;

    @Before
    public void setUp() {
        columns = ServiceLoader.load(ColumnHandler.class);
        properties = ServiceLoader.load(PropertyHandler.class);
    }

    @Test
    public void testFindsLocalColumnHandler() {
        boolean found = false;
        for (final ColumnHandler handler : columns) {
            // this class is defined outside of the main classes in dbutils
            if (handler instanceof TestColumnHandler) {
                found = true;
            }
        }

        assertTrue(found);
    }

    @Test
    public void testFindsLocalPropertyHandler() {
        boolean found = false;
        for (final PropertyHandler handler : properties) {
            // this class is defined outside of the main classes in dbutils
            if (handler instanceof TestPropertyHandler) {