ahmaddarawshi / powermock

Automatically exported from code.google.com/p/powermock
0 stars 0 forks source link

StackOverflowError #89

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

I tryed to find the exactly steps to reproduce the problem, but I could't
find it. So, I've posted the source code of my test.

What is the expected output? What do you see instead?

I'm getting StackOverflowError when I uncomment the line
//@PrepareForTest({Project.class}) in the code listed at the end of this
report.

What version of the product are you using? On what operating system?

PowerMock 1.1.1 - Windows XP Media Center Edition
JUnit 4.5
Spring 2.5.6

Please provide any additional information below.

I'm using Spring 2.5.6 in my project with @Configurable annotation in my
Domains Objects. Project.close() is the method under testing. Project is a
Domain Object, so, it has the @Configurable annotation. I don't know if
this it the cause of the problem. If you need any other information, please
let me know.

This is my test code:

package br.com.imperion.seomasterpro.core.project;

import static org.easymock.EasyMock.expect;
import static org.powermock.api.easymock.PowerMock.createMock;
import static org.powermock.api.easymock.PowerMock.createMockAndExpectNew;
import static org.powermock.api.easymock.PowerMock.replayAll;
import static org.powermock.api.easymock.PowerMock.verifyAll;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

import br.com.imperion.seomasterpro.core.infrastructure.IdentityMap;
import
br.com.imperion.seomasterpro.core.infrastructure.events.EventsAggregator;

@RunWith(PowerMockRunner.class)
//@PrepareForTest({Project.class})
public class ProjectTest {

    private IdentityMap identityMap;
    private EventsAggregator eventsAggregator;
    private Project project;

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
    }

    @AfterClass
    public static void tearDownAfterClass() throws Exception {
    }

    @Before
    public void setUp() throws Exception {

        identityMap = createMock(IdentityMap.class);
        eventsAggregator = createMock(EventsAggregator.class);

        project = new Project();

        project.setIdentityMap(identityMap);
        project.setEventsAggregator(eventsAggregator);

    }

    @After
    public void tearDown() throws Exception {
    }

    @Test
    public final void testClose_OK() throws Exception {
        CloseProjectEvent closeProjectEvent =
createMockAndExpectNew(CloseProjectEvent.class,project, false);

        expect(closeProjectEvent.closeCancelled()).andReturn(false);
        eventsAggregator.notifyObserver(project,
                ProjectObserver.CLOSE_PROJECT_EVENT, closeProjectEvent);
        identityMap.clear();

        replayAll();

        project.close();

        verifyAll();
    }

    @Test
    @Ignore
    public final void testClose_Cancelled() {

    }

}

Original issue reported on code.google.com by gustavoh...@gmail.com on 20 Jan 2009 at 8:10

GoogleCodeExporter commented 9 years ago
Hi, could you please bring this up on our mailing list (goto
http://groups.google.com/group/powermock) so that we can discuss it there? (Just
paste everything you wrote here). If you can please try to include the source 
of the
artifact that you're to test in the mail as well.

/Johan

Original comment by johan.ha...@gmail.com on 22 Jan 2009 at 9:34

GoogleCodeExporter commented 9 years ago
Please provide the stack trace as well.

Original comment by johan.ha...@gmail.com on 22 Jan 2009 at 10:02

GoogleCodeExporter commented 9 years ago
Hi all,

sorry guys, I couldn't find this discussion list in main site. That's why I've 
opened
this issue in the issue tracker. This problem is the same of the previous
StackOverflowError discussed in this list. Something related with override of
hashCode method. I've checked out the trunk version and solved the problem. 

Thanks,

Original comment by gustavoh...@gmail.com on 22 Jan 2009 at 12:24

GoogleCodeExporter commented 9 years ago
That's great, I suspected that they were related. We're about to release a new
version any day now which will include this fix. I'm really glad that you tried 
the
trunk version and validated that the fix works.

/Johan

Original comment by johan.ha...@gmail.com on 22 Jan 2009 at 1:42

GoogleCodeExporter commented 9 years ago
I have the same Issue with PowerMockito and a following StackOverFlow. It seems 
to be a problem, if you use multiple inheritance. Is it possible?

Original comment by michael....@gmail.com on 31 Aug 2011 at 3:12