// Path: src/test/java/com/mistraltech/smog/examples/model/Person.java
// public class Person extends Addressee {
//     private int age;
//     private Map<PhoneType, Phone> phoneMap;
// 
//     public Person(String name, int age, Address address, Map<PhoneType, Phone> phoneMap) {
//         super(name, address);
//         this.age = age;
//         this.phoneMap = phoneMap;
//     }
// 
//     public int getAge() {
//         return age;
//     }
// 
//     public Phone[] getPhones() {
//         return phoneMap.values().toArray(new Phone[phoneMap.size()]);
//     }
// 
//     public List<Phone> getPhoneList() {
//         List<Phone> phoneList = new ArrayList<Phone>(phoneMap.values());
//         Collections.sort(phoneList, new PhoneComparator());
//         return phoneList;
//     }
// 
//     public Map<PhoneType, Phone> getPhoneMap() {
//         return phoneMap;
//     }
// 
//     @Override
//     public String toString() {
//         return "Person{" +
//                 "age=" + age +
//                 ", phoneMap=" + phoneMap +
//                 "} " + super.toString();
//     }
// }
// 
// Path: src/test/java/com/mistraltech/smog/examples/model/PersonBuilder.java
// public static PersonBuilder aPerson() {
//     return new PersonBuilder();
// }
// 
// Path: src/test/java/com/mistraltech/smog/examples/simple/matcher/AddressMatcher.java
// public static AddressMatcher anAddressThat() {
//     return new AddressMatcher();
// }
// 
// Path: src/test/java/com/mistraltech/smog/examples/simple/matcher/PersonMatcher.java
// public static PersonMatcher aPersonThat() {
//     return new PersonMatcher();
// }
// 
// Path: src/test/java/com/mistraltech/smog/examples/simple/matcher/PostCodeMatcher.java
// public static PostCodeMatcher aPostCodeThat() {
//     return new PostCodeMatcher();
// }


import com.mistraltech.smog.examples.model.Address;
import com.mistraltech.smog.examples.model.Person;
import com.mistraltech.smog.examples.model.PostCode;
import org.hamcrest.Matchers;
import org.junit.Test;
import static com.mistraltech.smog.examples.model.PersonBuilder.aPerson;
import static com.mistraltech.smog.examples.simple.matcher.AddressMatcher.anAddressThat;
import static com.mistraltech.smog.examples.simple.matcher.PersonMatcher.aPersonThat;
import static com.mistraltech.smog.examples.simple.matcher.PostCodeMatcher.aPostCodeThat;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
package com.mistraltech.smog.examples.simple;



public class SimpleMatcherExamplesMockStubbingTest {
    private Person brian = aPerson()
            .withName("Brian")
            .withAge(26)
            .withAddress(new Address(73, new PostCode("out", "in")))
            .build();

    @Test
    public void testMock() {
        Converter converter = mock(Converter.class);

        when(converter.personToName(argThat(is(aPersonThat()
                        .hasName(startsWith("B"))
                        .hasAddress(anAddressThat()
                                        .hasPostCode(aPostCodeThat()
                                                .hasInner("in"))
                        )
        )))).thenReturn("Billie");

        // The mock expectation should match and returns "Billie"

        assertThat(converter.personToName(brian), equalTo("Billie"));
    }

    @Test
    public void testMockFailure() {
        Converter converter = mock(Converter.class);

        when(converter.personToName(argThat(is(aPersonThat()
                        .hasName(startsWith("B")).hasAddress(anAddressThat()
                                        .hasHouseNumber(37)
// Path: src/test/java/com/mistraltech/smog/examples/model/Person.java
// public class Person extends Addressee {
//     private int age;
//     private Map<PhoneType, Phone> phoneMap;
// 
//     public Person(String name, int age, Address address, Map<PhoneType, Phone> phoneMap) {
//         super(name, address);
//         this.age = age;
//         this.phoneMap = phoneMap;
//     }
// 
//     public int getAge() {
//         return age;
//     }
// 
//     public Phone[] getPhones() {
//         return phoneMap.values().toArray(new Phone[phoneMap.size()]);
//     }
// 
//     public List<Phone> getPhoneList() {
//         List<Phone> phoneList = new ArrayList<Phone>(phoneMap.values());
//         Collections.sort(phoneList, new PhoneComparator());
//         return phoneList;
//     }
// 
//     public Map<PhoneType, Phone> getPhoneMap() {
//         return phoneMap;
//     }
// 
//     @Override
//     public String toString() {
//         return "Person{" +
//                 "age=" + age +
//                 ", phoneMap=" + phoneMap +
//                 "} " + super.toString();
//     }
// }
// 
// Path: src/test/java/com/mistraltech/smog/examples/model/PersonBuilder.java
// public static PersonBuilder aPerson() {
//     return new PersonBuilder();
// }
// 
// Path: src/test/java/com/mistraltech/smog/examples/simple/matcher/AddressMatcher.java
// public static AddressMatcher anAddressThat() {
//     return new AddressMatcher();
// }
// 
// Path: src/test/java/com/mistraltech/smog/examples/simple/matcher/PersonMatcher.java
// public static PersonMatcher aPersonThat() {
//     return new PersonMatcher();
// }
// 
// Path: src/test/java/com/mistraltech/smog/examples/simple/matcher/PostCodeMatcher.java
// public static PostCodeMatcher aPostCodeThat() {
//     return new PostCodeMatcher();
// }


// Path: src/test/java/com/mistraltech/smog/examples/simple/SimpleMatcherExamplesMockStubbingTest.java
import com.mistraltech.smog.examples.model.Address;
import com.mistraltech.smog.examples.model.Person;
import com.mistraltech.smog.examples.model.PostCode;
import org.hamcrest.Matchers;
import org.junit.Test;
import static com.mistraltech.smog.examples.model.PersonBuilder.aPerson;
import static com.mistraltech.smog.examples.simple.matcher.AddressMatcher.anAddressThat;
import static com.mistraltech.smog.examples.simple.matcher.PersonMatcher.aPersonThat;
import static com.mistraltech.smog.examples.simple.matcher.PostCodeMatcher.aPostCodeThat;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

package com.mistraltech.smog.examples.simple;



public class SimpleMatcherExamplesMockStubbingTest {
    private Person brian = aPerson()
            .withName("Brian")
            .withAge(26)
            .withAddress(new Address(73, new PostCode("out", "in")))
            .build();

    @Test
    public void testMock() {
        Converter converter = mock(Converter.class);

        when(converter.personToName(argThat(is(aPersonThat()
                        .hasName(startsWith("B"))
                        .hasAddress(anAddressThat()
                                        .hasPostCode(aPostCodeThat()
                                                .hasInner("in"))
                        )
        )))).thenReturn("Billie");

        // The mock expectation should match and returns "Billie"

        assertThat(converter.personToName(brian), equalTo("Billie"));
    }

    @Test
    public void testMockFailure() {
        Converter converter = mock(Converter.class);

        when(converter.personToName(argThat(is(aPersonThat()
                        .hasName(startsWith("B")).hasAddress(anAddressThat()
                                        .hasHouseNumber(37)
                                        .hasPostCode(aPostCodeThat()