// Path: mock/src/test/java/jinsist/mock/testtypes/Collaborator.java
// public class Collaborator {
//     public String publicProperty = "property value";
// 
//     public String firstMethod(String param) {
//         throw new UnsupportedOperationException("firstMethod was called from implementation.");
//     }
// 
//     public String secondMethod(String param, String param2) {
//         throw new UnsupportedOperationException("secondMethod was called from implementation.");
//     }
// 
//     public void voidMethod() {
//     }
// 
//     public int primitiveMethod() {
//         return 0;
//     }
// }
// 
// Path: mock/src/test/java/jinsist/mock/testtypes/TestFactories.java
// public class TestFactories {
// 
//     protected List<Stub> registry = new ArrayList<>();
//     protected Method firstMethod = Collaborator.class.getMethod("firstMethod", String.class);
//     protected Method voidMethod = Collaborator.class.getMethod("voidMethod");
//     protected String input = "value";
// 
//     protected TestFactories() throws NoSuchMethodException {
//     }
// 
//     protected Arguments argumentsOf(Object... values) {
//         return new Arguments(Arrays.stream(values).map(EqualsMatcher::new).collect(toList()));
//     }
// 
//     protected <MockType, ReturnType> Stub<MockType, ReturnType> stub(
//             Class<MockType> type, Method method, Arguments arguments, ReturnType result
//     ) {
//         return new Stub<>(type, method, arguments, result);
//     }
// 
//     protected <MockType, ReturnType> Stub<MockType, ReturnType> stub(
//             Class<MockType> type, Method method, Arguments arguments
//     ) {
//         return new Stub<>(type, method, arguments, null);
//     }
// 
//     protected <MockType, ReturnType> Stub<MockType, ReturnType> stub(Class<MockType> type, Method method) {
//         return new Stub<>(type, method, new Arguments(emptyList()), null);
//     }
// 
//     protected Expectations expectations = new Expectations() {
// 
//         @Override
//         public <ReturnType, MockType> void recordStub(
//                 Class<MockType> classToMock, MockType instance, Method method, Arguments arguments, ReturnType result
//         ) {
//             registry.add(new Stub<>(classToMock, method, arguments, result));
//         }
// 
//         @Override
//         public <MockType> Object execute(
//                 Class<MockType> classToMock, MockType instance, Method method, Object[] arguments
//         ) {
//             return null;
//         }
// 
//         @Override
//         public void verify() {
// 
//         }
//     };
// }


import jinsist.mock.testtypes.Collaborator;
import jinsist.mock.testtypes.TestFactories;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
package jinsist.mock;



public class MockQueryTest extends TestFactories {
    @Test
    public void stubsMethod() {
        Mock<Collaborator> collaboratorMock = new Mock<>(Collaborator.class, expectations);

        collaboratorMock.query(mock -> mock.firstMethod("input")).returns("output");

        assertEquals(stub(Collaborator.class, firstMethod, argumentsOf("input"), "output"), registry.get(0));
    }

    @Test(expected = MethodToStubNotFound.class)
    public void failsOnPublicPropertyStubbing() {
// Path: mock/src/test/java/jinsist/mock/testtypes/Collaborator.java
// public class Collaborator {
//     public String publicProperty = "property value";
// 
//     public String firstMethod(String param) {
//         throw new UnsupportedOperationException("firstMethod was called from implementation.");
//     }
// 
//     public String secondMethod(String param, String param2) {
//         throw new UnsupportedOperationException("secondMethod was called from implementation.");
//     }
// 
//     public void voidMethod() {
//     }
// 
//     public int primitiveMethod() {
//         return 0;
//     }
// }
// 
// Path: mock/src/test/java/jinsist/mock/testtypes/TestFactories.java
// public class TestFactories {
// 
//     protected List<Stub> registry = new ArrayList<>();
//     protected Method firstMethod = Collaborator.class.getMethod("firstMethod", String.class);
//     protected Method voidMethod = Collaborator.class.getMethod("voidMethod");
//     protected String input = "value";
// 
//     protected TestFactories() throws NoSuchMethodException {
//     }
// 
//     protected Arguments argumentsOf(Object... values) {
//         return new Arguments(Arrays.stream(values).map(EqualsMatcher::new).collect(toList()));
//     }
// 
//     protected <MockType, ReturnType> Stub<MockType, ReturnType> stub(
//             Class<MockType> type, Method method, Arguments arguments, ReturnType result
//     ) {
//         return new Stub<>(type, method, arguments, result);
//     }
// 
//     protected <MockType, ReturnType> Stub<MockType, ReturnType> stub(
//             Class<MockType> type, Method method, Arguments arguments
//     ) {
//         return new Stub<>(type, method, arguments, null);
//     }
// 
//     protected <MockType, ReturnType> Stub<MockType, ReturnType> stub(Class<MockType> type, Method method) {
//         return new Stub<>(type, method, new Arguments(emptyList()), null);
//     }
// 
//     protected Expectations expectations = new Expectations() {
// 
//         @Override
//         public <ReturnType, MockType> void recordStub(
//                 Class<MockType> classToMock, MockType instance, Method method, Arguments arguments, ReturnType result
//         ) {
//             registry.add(new Stub<>(classToMock, method, arguments, result));
//         }
// 
//         @Override
//         public <MockType> Object execute(
//                 Class<MockType> classToMock, MockType instance, Method method, Object[] arguments
//         ) {
//             return null;
//         }
// 
//         @Override
//         public void verify() {
// 
//         }
//     };
// }


// Path: mock/src/test/java/jinsist/mock/MockQueryTest.java
import jinsist.mock.testtypes.Collaborator;
import jinsist.mock.testtypes.TestFactories;
import org.junit.Test;
import static org.junit.Assert.assertEquals;

package jinsist.mock;



public class MockQueryTest extends TestFactories {
    @Test
    public void stubsMethod() {
        Mock<Collaborator> collaboratorMock = new Mock<>(Collaborator.class, expectations);

        collaboratorMock.query(mock -> mock.firstMethod("input")).returns("output");

        assertEquals(stub(Collaborator.class, firstMethod, argumentsOf("input"), "output"), registry.get(0));
    }

    @Test(expected = MethodToStubNotFound.class)
    public void failsOnPublicPropertyStubbing() {
        Mock<Collaborator> collaboratorMock = new Mock<>(Collaborator.class, expectations);