Package mockit

Examples of mockit.Expectations


    @Test
    public void closeIfError(
            @Injectable final  InputStreamReader reader,
            @Injectable final CSVParser parser) throws IOException {
        new Expectations() {
            {
                parser.getLine();
                result = new String[] {"1"};

                parser.getLine();
View Full Code Here


    }

    @Test
    public void normalCycle(@Injectable final InputStreamReader reader,
                            @Injectable final CSVParser parser) throws IOException {
        new Expectations() {
            {
                parser.getLine();
                result = new String[] {"1"};

                parser.getLine();
View Full Code Here

        Main.main( args );
    }

    @Test
    public void invokesReadAndWrite() throws Exception {
        new Expectations() {
            {
                new Read( "Fiddle-Faddle" );
                Write write = new Write();
                write.init( "Fiddle-Faddle" );
            }
View Full Code Here

    }

    @Test
    public final void testSingleRecipient() throws Exception {

        new Expectations() {
            {
                backendServer.connect();
                result = smartClient;

                smartClient.dataEnd();
View Full Code Here

    }

    @Test
    public final void testTwoRecipientsSingleDestination() throws Exception {

        new Expectations() {
            {
                backendServer.connect();
                result = smartClient;

                smartClient.to(anyString);
View Full Code Here

    @NonStrict
    private Lookup lookup;

    @Test
    public void testQueryAddresses() throws SendException {
        new Expectations() {
            {
                lookup.run();
                result =
                        new Record[] {
                                new ARecord(HOST1_EXAMPLE_COM_NAME, 0, 0, IP1),
View Full Code Here

        assertArrayEquals(expected, addresses);
    }

    @Test
    public void testQueryAddressesIpv6() throws SendException {
        new Expectations() {
            {
                lookup.run();
                result =
                        new Record[] { new AAAARecord(HOST6_EXAMPLE_COM_NAME,
                                0, 0, IPV6)
View Full Code Here

        assertArrayEquals(expected, addresses);
    }

    @Test
    public void testTransientDnsFailure() {
        new Expectations() {
            {
                lookup.run();
                result = null;

                lookup.getResult();
View Full Code Here

    private Lookup lookup;
    private MxLookup mxLookup = new MxLookup(EXAMPLE_COM_DOMAIN);

    @Test()
    public void testNoMxRecords() throws MxLookupException {
        new Expectations() {
            {
                lookup.run();
                result = null;

                lookup.getResult();
View Full Code Here

        assertArrayEquals(new Name[] { EXAMPLE_COM_NAME }, targets);
    }

    @Test(expected = SendException.class)
    public void testHostNotFound() throws MxLookupException {
        new Expectations() {
            {
                lookup.run();
                result = null;

                lookup.getResult();
View Full Code Here

TOP

Related Classes of mockit.Expectations

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.