Package org.jmock

Examples of org.jmock.Mockery.mock()


    private static final String CTX = "";

    public void test_getBaseUrl() {

        final Mockery ctx = new Mockery();
        final HttpServletRequest request = ctx.mock(HttpServletRequest.class);
        ctx.checking(new Expectations() {
            {
                // general setup on each calls
                allowing(request).getServerName();
                will(returnValue(NAME));
View Full Code Here


        PrivateAccessor.setField(servlet, "config", config);
        PrivateAccessor.setField(servlet, "clusterViewService", clusterViewService);
        PrivateAccessor.setField(servlet, "announcementRegistry", announcementRegistry);

        Mockery context = new JUnit4Mockery();
        final HttpService httpService = context.mock(HttpService.class);
        context.checking(new Expectations() {
            {
                allowing(httpService).registerServlet(with(any(String.class)),
                        with(any(Servlet.class)),
                        with(any(Dictionary.class)),
View Full Code Here

    public static ResourceResolverFactory mockResourceResolverFactory(final SlingRepository repositoryOrNull)
            throws Exception {
        Mockery context = new JUnit4Mockery();

        final ResourceResolverFactory resourceResolverFactory = context
                .mock(ResourceResolverFactory.class);
        // final ResourceResolver resourceResolver = new MockResourceResolver();
        // final ResourceResolver resourceResolver = new
        // MockedResourceResolver();
View Full Code Here

    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

        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

                        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

        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

    @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

    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

        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

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.