Package org.easymock

Examples of org.easymock.IAnswer


        Class asoClass = ReadOnlyBean.class;
        final Holder holder = new Holder();

        train_get(source, ApplicationStateManagerImpl.DEFAULT_STRATEGY, strategy);

        IAnswer answer = new IAnswer()
        {
            public Object answer() throws Throwable
            {
                ApplicationStateCreator creator = (ApplicationStateCreator) EasyMock
                        .getCurrentArguments()[1];
View Full Code Here


    {
        final AtomicReference disable = new AtomicReference();
        final AtomicReference enable = new AtomicReference();
       
        EasyMock.expect(mockBundleContext.getProperty(DirectoryWatcher.DISABLE_CONFIG_SAVE)).andAnswer(
                new IAnswer() {
                    public Object answer() throws Throwable {
                        return disable.get() != null ? disable.get().toString() : null;
                    }
                }
        ).anyTimes();
        EasyMock.expect(mockBundleContext.getProperty(DirectoryWatcher.ENABLE_CONFIG_SAVE)).andAnswer(
                new IAnswer() {
                    public Object answer() throws Throwable {
                        return enable.get() != null ? enable.get().toString() : null;
                    }
                }
        ).anyTimes();
View Full Code Here

    @SuppressWarnings("unchecked")
    protected final void train_renderInformalParameters(ComponentResources resources,
            final MarkupWriter writer, final Object... informals)
    {
        resources.renderInformalParameters(writer);
        IAnswer answer = new IAnswer()
        {
            public Object answer() throws Throwable
            {
                writer.attributes(informals);
View Full Code Here

    @SuppressWarnings("unchecked")
    protected void setUp() throws Exception {
        super.setUp();
        ImplementationProcessorService service = EasyMock.createMock(ImplementationProcessorService.class);
        service.addName(EasyMock.isA(List.class), EasyMock.eq(0), EasyMock.eq("test"));
        EasyMock.expectLastCall().andStubAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                ((List<Object>) EasyMock.getCurrentArguments()[0]).add("test");
                return null;
            }
        });
View Full Code Here

    @SuppressWarnings("unchecked")
    protected final void train_renderInformalParameters(ComponentResources resources, final MarkupWriter writer,
                                                        final Object... informals)
    {
        resources.renderInformalParameters(writer);
        IAnswer answer = new IAnswer()
        {
            public Object answer() throws Throwable
            {
                writer.attributes(informals);
View Full Code Here

        Class asoClass = ReadOnlyBean.class;
        final Holder holder = new Holder();

        train_get(source, ApplicationStateManagerImpl.DEFAULT_STRATEGY, strategy);

        IAnswer answer = new IAnswer()
        {
            public Object answer() throws Throwable
            {
                ApplicationStateCreator creator = (ApplicationStateCreator) EasyMock
                        .getCurrentArguments()[1];
View Full Code Here

        parent = EasyMock.createMock(CompositeComponent.class);
        EasyMock.expect(parent.resolveSystemInstance(EntityManagerFactory.class)).andReturn(emf).atLeastOnce();
        EasyMock.replay(parent);
        ImplementationProcessorService service = EasyMock.createMock(ImplementationProcessorService.class);
        service.addName(EasyMock.isA(List.class), EasyMock.eq(0), EasyMock.isA(String.class));
        EasyMock.expectLastCall().andStubAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                ((List<Object>) EasyMock.getCurrentArguments()[0]).add(EasyMock.getCurrentArguments()[2]);
                return null;
            }
        });
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        GroovyClassLoader cl = new GroovyClassLoader(getClass().getClassLoader());
        implClass = cl.parseClass(SCRIPT);
        scopeContainer = createMock(ScopeContainer.class);
        expect(scopeContainer.getInstance(isA(AtomicComponent.class))).andStubAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                return ((AtomicComponent) getCurrentArguments()[0]).createInstance();
            }
        });
        replay(scopeContainer);
View Full Code Here

        AsyncMonitor monitor = createMock(AsyncMonitor.class);
        replay(monitor);

        WorkScheduler scheduler = createMock(WorkScheduler.class);
        scheduler.scheduleWork(isA(Runnable.class));
        expectLastCall().andStubAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                Runnable runnable = (Runnable) getCurrentArguments()[0];
                runnable.run();
                return null;
            }
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        GroovyClassLoader cl = new GroovyClassLoader(getClass().getClassLoader());
        implClass = cl.parseClass(SCRIPT);
        scopeContainer = createMock(ScopeContainer.class);
        expect(scopeContainer.getInstance(isA(AtomicComponent.class))).andStubAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                return ((AtomicComponent) getCurrentArguments()[0]).createInstance();
            }
        });
        replay(scopeContainer);
View Full Code Here

TOP

Related Classes of org.easymock.IAnswer

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.