// Path: src/main/java/com/timgroup/karg/functions/KeywordFunction.java
// public interface KeywordFunction<T> extends Function<KeywordArguments, T> { }
// 
// Path: src/main/java/com/timgroup/karg/multipledispatch/CandidateFunctionRegistry.java
// public class CandidateFunctionRegistry<T> {
//     
//     private final List<CandidateFunction<T>> candidates = newArrayList();
//     
//     public static interface MatchBuilder<T> {
//         void with(Function<KeywordArguments, T> function);
//     }
//     
//     public MatchBuilder<T> match(final Predicate<KeywordArguments> predicate) {
//         return new MatchBuilder<T>() {
//             @Override
//             public void with(Function<KeywordArguments, T> function) {
//                 candidates.add(new CandidateFunction<T>(predicate, function));
//             }
//         };
//     }
//     
//     public CandidateFunction<T> findCandidateMatching(KeywordArguments parameters) {
//         try {
//             return Iterables.find(candidates, matchesParameters(parameters));
//         } catch (NoSuchElementException e) {
//             throw new UnsupportedOperationException("No candidate function was found matching the supplied parameters.");
//         }
//     }
//     
//     private Predicate<CandidateFunction<T>> matchesParameters(final KeywordArguments parameters) {
//         return new Predicate<CandidateFunction<T>>() {
//             @Override public boolean apply(CandidateFunction<T> candidate) {
//                 return candidate.matches(parameters);
//             }
//         };
//     }
// }


import org.jmock.Expectations;
import org.jmock.Mockery;
import org.junit.Test;
import com.google.common.base.Predicate;
import com.timgroup.karg.functions.KeywordFunction;
import com.timgroup.karg.multipledispatch.CandidateFunctionRegistry;
package com.timgroup.karg.keywords;



public class CandidateFunctionRegistryTest {

    private final Mockery context = new Mockery();
    
    @SuppressWarnings("unchecked")
    private final KeywordFunction<String> function = context.mock(KeywordFunction.class);
    
    @SuppressWarnings("unchecked")
    private final Predicate<KeywordArguments> predicate = context.mock(Predicate.class);
    
    @Test public void
    registers_a_function_bound_to_a_predicate() {
        final KeywordArguments arguments = KeywordArguments.empty();
// Path: src/main/java/com/timgroup/karg/functions/KeywordFunction.java
// public interface KeywordFunction<T> extends Function<KeywordArguments, T> { }
// 
// Path: src/main/java/com/timgroup/karg/multipledispatch/CandidateFunctionRegistry.java
// public class CandidateFunctionRegistry<T> {
//     
//     private final List<CandidateFunction<T>> candidates = newArrayList();
//     
//     public static interface MatchBuilder<T> {
//         void with(Function<KeywordArguments, T> function);
//     }
//     
//     public MatchBuilder<T> match(final Predicate<KeywordArguments> predicate) {
//         return new MatchBuilder<T>() {
//             @Override
//             public void with(Function<KeywordArguments, T> function) {
//                 candidates.add(new CandidateFunction<T>(predicate, function));
//             }
//         };
//     }
//     
//     public CandidateFunction<T> findCandidateMatching(KeywordArguments parameters) {
//         try {
//             return Iterables.find(candidates, matchesParameters(parameters));
//         } catch (NoSuchElementException e) {
//             throw new UnsupportedOperationException("No candidate function was found matching the supplied parameters.");
//         }
//     }
//     
//     private Predicate<CandidateFunction<T>> matchesParameters(final KeywordArguments parameters) {
//         return new Predicate<CandidateFunction<T>>() {
//             @Override public boolean apply(CandidateFunction<T> candidate) {
//                 return candidate.matches(parameters);
//             }
//         };
//     }
// }


// Path: src/test/java/com/timgroup/karg/keywords/CandidateFunctionRegistryTest.java
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.junit.Test;
import com.google.common.base.Predicate;
import com.timgroup.karg.functions.KeywordFunction;
import com.timgroup.karg.multipledispatch.CandidateFunctionRegistry;

package com.timgroup.karg.keywords;



public class CandidateFunctionRegistryTest {

    private final Mockery context = new Mockery();
    
    @SuppressWarnings("unchecked")
    private final KeywordFunction<String> function = context.mock(KeywordFunction.class);
    
    @SuppressWarnings("unchecked")
    private final Predicate<KeywordArguments> predicate = context.mock(Predicate.class);
    
    @Test public void
    registers_a_function_bound_to_a_predicate() {
        final KeywordArguments arguments = KeywordArguments.empty();
        CandidateFunctionRegistry<String> registry = new CandidateFunctionRegistry<String>();