Open GoogleCodeExporter opened 9 years ago
Hi
Are you using java7?
Original comment by johan.ha...@gmail.com
on 19 Feb 2012 at 5:19
Hi,
No, we are using Java 6 with 1.5 code compliance.
Original comment by a.vermin...@gmail.com
on 19 Feb 2012 at 5:21
We are running into this with Java 6, too, and it is preventing us from
implementing a whole swath of tests. Any update? Anything info we can provide
to assist?
Original comment by seangc...@gmail.com
on 18 Apr 2012 at 8:47
Hi, we are facing this issue since many days and eagerly looking for a fix to
the above mentioned ticket. Is there any update regarding this ticket. Your
update would really be helpful for us to proceed further.
Original comment by bharath...@gmail.com
on 13 Jun 2012 at 7:31
Are you using Java7?
Original comment by johan.ha...@gmail.com
on 13 Jun 2012 at 7:43
No, we are using Java6. Didn't tried it yet with Java7.
Original comment by a.vermin...@gmail.com
on 13 Jun 2012 at 8:49
What class are you preparing for test?
Original comment by johan.ha...@gmail.com
on 13 Jun 2012 at 10:56
By preparing for test, do you mean: @PrepareForTest( { String.class } )?? It
doesn't matter which class get's prepared, it's always the same issue.
Original comment by a.vermin...@gmail.com
on 14 Jun 2012 at 11:35
Yes that's what I mean. Hmm are you sure that it doesn't matter? In the example
in this issue it works fine if nothing is prepared (@PrepareForTest is not used
at all).
Original comment by johan.ha...@gmail.com
on 18 Jun 2012 at 6:18
Yes, without @PrepareForTest it's fine. But we have test cases, where we want
to mock GUI and also we need @PrepareForTest, because we mock some final or
private methods...
Original comment by a.vermin...@gmail.com
on 18 Jun 2012 at 10:11
I understand. I strongly encourage to refactor your code and break-out the
functionality into a new class that can be tested in isolation. In that way you
probably don't even need PowerMock. For testing the UI interaction another
framework should probably be just, fest-swing or something similar.
Original comment by johan.ha...@gmail.com
on 18 Jun 2012 at 10:24
The PrepareForTest annotation doesn't even need to specify any classes (but it
needs to be present), for the VerifyError to be thrown - see example below.
This is with the latest versions of mockito, powermock-module-junit4 and
powermock-api-mockito (and their Maven dependencies).
A question was asked regarding which version of Java - is this fixed in Java 7
then?
@RunWith(PowerMockRunner.class)
@PrepareForTest // Don't even need to specify any classes to prepare!
public class VerifyErrorTest {
@Test
public void test() {
new JFrame();
}
}
Original comment by matt.s.w...@gmail.com
on 8 Feb 2013 at 12:15
PrepareForTest automatically prepares your test case so that might be what's
causing it.
Original comment by johan.ha...@gmail.com
on 8 Feb 2013 at 3:58
Have just tried this in Java 7 (v1.7.0_45) and it's still not fixed :-(
Original comment by matt.s.w...@gmail.com
on 21 Jan 2014 at 11:49
Here's a neat workaround/solution that a colleague of mine discovered today:
Just add the annotation @PowerMockIgnore("javax.swing.*") to the test class and
PowerMock will defer the loading of the problematic classes to the system
classloader.
Original comment by matt.s.w...@gmail.com
on 21 Jan 2014 at 4:20
I changed the project system library to j2se-1.5 to fix this. There may be a
problem with the jre you are using.
Original comment by fmayrand...@gmail.com
on 8 Oct 2014 at 8:05
Original issue reported on code.google.com by
a.vermin...@gmail.com
on 20 Jan 2012 at 4:47