Examples of mock()


Examples of org.jmock.Mockery.mock()

    public static SlingSettingsService mockSlingSettingsService(
            final String slingId) {
        Mockery context = new JUnit4Mockery();

        final SlingSettingsService settingsService = context
                .mock(SlingSettingsService.class);
        context.checking(new Expectations() {
            {
                allowing(settingsService).getSlingId();
                will(returnValue(slingId));
View Full Code Here

Examples of org.jmock.Mockery.mock()

        return settingsService;
    }

    public static ComponentContext mockComponentContext() {
        Mockery context = new JUnit4Mockery();
        final BundleContext bc = context.mock(BundleContext.class);
        context.checking(new Expectations() {
            {
                allowing(bc).registerService(with(any(String.class)),
                        with(any(Object.class)), with(any(Dictionary.class)));
                will(VoidAction.INSTANCE);
View Full Code Here

Examples of org.jmock.Mockery.mock()

                        with(any(Object.class)), with(any(Dictionary.class)));
                will(VoidAction.INSTANCE);
            }
        });

        final ComponentContext cc = context.mock(ComponentContext.class);
        context.checking(new Expectations() {
            {
                allowing(cc).getProperties();
                will(returnValue(new Properties()));
View Full Code Here

Examples of org.jmock.Mockery.mock()

        final File root = new File("bundle999").getAbsoluteFile();
        final SlingHomeAction slingHome = new SlingHomeAction();
        slingHome.setSlingHome(new File("sling").getAbsolutePath());

        Mockery context = new Mockery();
        final BundleContext bundleContext = context.mock(BundleContext.class);

        context.checking(new Expectations() {
            {
                // mock access to sling.home framework property
                allowing(bundleContext).getProperty("sling.home");
View Full Code Here

Examples of org.jmock.Mockery.mock()

    @Test
    public void testExistingNode() throws Exception {
        final Mockery mockery = new Mockery();
        final DeepNodeCreator c = new DeepNodeCreator();
        final String path = "/foo/bar";
        final Session s = mockery.mock(Session.class);
        final Node n = mockery.mock(Node.class);
       
        mockery.checking(new Expectations() {{
            allowing(s).itemExists(path);
            will(returnValue(true));
View Full Code Here

Examples of org.jmock.Mockery.mock()

    public void testExistingNode() throws Exception {
        final Mockery mockery = new Mockery();
        final DeepNodeCreator c = new DeepNodeCreator();
        final String path = "/foo/bar";
        final Session s = mockery.mock(Session.class);
        final Node n = mockery.mock(Node.class);
       
        mockery.checking(new Expectations() {{
            allowing(s).itemExists(path);
            will(returnValue(true));
View Full Code Here

Examples of org.jmock.Mockery.mock()

        final Mockery mockery = new Mockery();
        final DeepNodeCreator c = new DeepNodeCreator();
        final String rootPath = "/";
        final String fooPath = "/foo";
        final String barPath = "/foo/bar";
        final Session s = mockery.mock(Session.class);
        final Node root = mockery.mock(Node.class, rootPath);
        final Node foo = mockery.mock(Node.class, fooPath);
        final Node bar = mockery.mock(Node.class, barPath);
        final String testNodeType = "NT_TEST";
       
View Full Code Here

Examples of org.jmock.Mockery.mock()

        final DeepNodeCreator c = new DeepNodeCreator();
        final String rootPath = "/";
        final String fooPath = "/foo";
        final String barPath = "/foo/bar";
        final Session s = mockery.mock(Session.class);
        final Node root = mockery.mock(Node.class, rootPath);
        final Node foo = mockery.mock(Node.class, fooPath);
        final Node bar = mockery.mock(Node.class, barPath);
        final String testNodeType = "NT_TEST";
       
        mockery.checking(new Expectations() {{
View Full Code Here

Examples of org.jmock.Mockery.mock()

        final String rootPath = "/";
        final String fooPath = "/foo";
        final String barPath = "/foo/bar";
        final Session s = mockery.mock(Session.class);
        final Node root = mockery.mock(Node.class, rootPath);
        final Node foo = mockery.mock(Node.class, fooPath);
        final Node bar = mockery.mock(Node.class, barPath);
        final String testNodeType = "NT_TEST";
       
        mockery.checking(new Expectations() {{
            allowing(s).itemExists(barPath);
View Full Code Here

Examples of org.jmock.Mockery.mock()

        final String fooPath = "/foo";
        final String barPath = "/foo/bar";
        final Session s = mockery.mock(Session.class);
        final Node root = mockery.mock(Node.class, rootPath);
        final Node foo = mockery.mock(Node.class, fooPath);
        final Node bar = mockery.mock(Node.class, barPath);
        final String testNodeType = "NT_TEST";
       
        mockery.checking(new Expectations() {{
            allowing(s).itemExists(barPath);
            will(returnValue(false));
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.