Examples of SuppressMethod


Examples of samples.suppressmethod.SuppressMethod

    @Test
    public void suppressSingleMethodExample() throws Exception {
        suppress(method(SuppressMethod.class, "getObject"));

        assertNull(new SuppressMethod().getObject());
    }
View Full Code Here

Examples of samples.suppressmethod.SuppressMethod

    @Test
    public void suppressMultipleMethodsExample1() throws Exception {
        suppress(methods(SuppressMethod.class, "getObject", "getInt"));

        assertNull(new SuppressMethod().getObject());
        assertEquals(0, new SuppressMethod().getInt());
    }
View Full Code Here

Examples of samples.suppressmethod.SuppressMethod

    @Test
    public void suppressMultipleMethodsExample2() throws Exception {
        suppress(methods(method(SuppressMethod.class, "getObject"), method(SuppressMethod.class, "getInt")));

        assertNull(new SuppressMethod().getObject());
        assertEquals(0, new SuppressMethod().getInt());
    }
View Full Code Here

Examples of samples.suppressmethod.SuppressMethod

    @Test
    public void suppressAllMethodsExample() throws Exception {
        suppress(methodsDeclaredIn(SuppressMethod.class));

        final SuppressMethod tested = new SuppressMethod();

        assertNull(tested.getObject());
        assertNull(SuppressMethod.getObjectStatic());
        assertEquals(0, tested.getByte());
    }
View Full Code Here

Examples of samples.suppressmethod.SuppressMethod

    @Test
    public void stubSingleMethodExample() throws Exception {
        final String expectedReturnValue = "new";
        stub(method(SuppressMethod.class, "getObject")).toReturn(expectedReturnValue);

        final SuppressMethod tested = new SuppressMethod();
        assertEquals(expectedReturnValue, tested.getObject());
        assertEquals(expectedReturnValue, tested.getObject());
    }
View Full Code Here

Examples of samples.suppressmethod.SuppressMethod

    @Test
    public void changingReturnValueExample() throws Exception {
        replace(method(SuppressMethod.class, "getObjectWithArgument")).with(new ReturnValueChangingInvocationHandler());

        final SuppressMethod tested = new SuppressMethod();

        assertThat(tested.getObjectWithArgument("don't do anything"), is(instanceOf(Object.class)));
        assertEquals("hello world", tested.getObjectWithArgument("make it a string"));
    }
View Full Code Here

Examples of samples.suppressmethod.SuppressMethod

    @Test
    public void testGetObject() throws Exception {
        suppress(method(SuppressMethod.class, "getObject"));

        SuppressMethod tested = new SuppressMethod();
        assertNull("A method returning Object should return null after suppressing method code.", tested.getObject());
    }
View Full Code Here

Examples of samples.suppressmethod.SuppressMethod

    @Test
    public void testSuppressMultipleMethods() throws Exception {
        suppress(methods(SuppressMethod.class, "getObject", "getShort"));

        SuppressMethod tested = new SuppressMethod();
        assertNull("A method returning Object should return null after suppressing method code.", tested.getObject());
        assertEquals("A method returning a short should return 0 after suppressing method code.", 0, tested.getShort());
    }
View Full Code Here

Examples of samples.suppressmethod.SuppressMethod

    @Test
    public void testGetByte() throws Exception {
        suppress(method(SuppressMethod.class, "getByte"));

        SuppressMethod tested = new SuppressMethod();
        assertEquals("A method returning a byte should return 0 after suppressing method code.", 0, tested.getByte());
    }
View Full Code Here

Examples of samples.suppressmethod.SuppressMethod

    @Test
    public void testGetShort() throws Exception {
        suppress(method(SuppressMethod.class, "getShort"));

        SuppressMethod tested = new SuppressMethod();
        assertEquals("A method returning a short should return 0 after suppressing method code.", 0, tested.getShort());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.