Suppressing static init blocks in java.sql.*

201 views
Skip to first unread message

Brad Stapleton

unread,
Oct 15, 2013, 1:08:48 PM10/15/13
to powe...@googlegroups.com
I saw this question on SO: http://stackoverflow.com/questions/19386542/cant-suppress-drivermanagers-static-initializer-block

Basically, it asks about removing the static initializer block from java.sql.DriverManager. I noticed this on the FAQ:


I cannot mock classes in from java.lang, java.net, java.io or other system classes, why?

This is because they're loaded by Java's bootstrap classloader and cannot be byte-code manipulated by PowerMock's classloader.


Is java.sql.* one of those sets of classes that cannot be manipulated?

Johan Haleby

unread,
Oct 16, 2013, 4:00:23 AM10/16/13
to powe...@googlegroups.com
Yes unfortunately I think so :(


--
You received this message because you are subscribed to the Google Groups "PowerMock" group.
To unsubscribe from this group and stop receiving emails from it, send an email to powermock+...@googlegroups.com.
To post to this group, send email to powe...@googlegroups.com.
Visit this group at http://groups.google.com/group/powermock.
For more options, visit https://groups.google.com/groups/opt_out.

Johan Haleby

unread,
Oct 16, 2013, 4:02:22 AM10/16/13
to powe...@googlegroups.com
You can mock, suppress methods, stub methods etc in these classes since powermock 1.2.5 but you cannot suppress static initializers.
Reply all
Reply to author
Forward
0 new messages