Comments (4)
Thanks for helping add support here! I've added the line to support Cobertura by default in 3b88efb.
I'd like to understand your Play issue so that GwtMockito can support it without people having to fork code. Are these the only two lines you added?
classPool.appendClassPath(new LoaderClassPath(Enhancer.class.getClassLoader()));
classPool.appendClassPath(new ApplicationClassesClasspath());
You can extend GwtMockitoTestRunner to override getAdditionalClassPaths , adding your own classpath entries. However, that only supports String
right now, not ClassPath
objects from Javassist. Are LoaderClassPath
and ApplicationClassesClasspath
actually ClassPath
objects defined by the Play library? If so, it wouldn't be hard to add another overridable version of getAdditionalClassPaths
letting you return ClassPath
objects.
from gwtmockito.
Are these the only two lines you added?
Not quite, there are two more changes:
protected ClassLoader getParentClassloader() {
// return ClassLoader.getSystemClassLoader();
return Play.classloader;
}
And (see GwtMockitoTestRunner.class.getClassLoader() replaced with Play GwtMockitoTestRunner.class.getClassLoader() ):
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
// If the class is in a blacklisted package, load it with the default classloader.
for (String blacklistedPackage : getPackagesToLoadViaStandardClassloader()) {
if (name.startsWith(blacklistedPackage)) {
//return GwtMockitoTestRunner.class.getClassLoader().loadClass(name);
return PlayGwtMockitoTestRunner.class.getClassLoader().loadClass(name);
}
}
// Otherwise load it with our custom classloader.
return super.loadClass(name);
}
Are LoaderClassPath and ApplicationClassesClasspath actually ClassPath objects defined by the Play library? If so, it wouldn't be hard to add another overridable version of getAdditionalClassPaths letting you return ClassPath objects.
Yes, I suppose that'd do the trick. Thanks!
from gwtmockito.
Cool, thanks, I'll take a look at adding these as additional customization options before the next release, sounds like your workaround should work for now.
from gwtmockito.
Yes, I'm fine with workaround for now. Just wanted to share it.
Thanks for your effort.
from gwtmockito.
Related Issues (20)
- getting GwtMockitoTestRunner$FailedCastException in DateBox HOT 1
- ClassCastException with JsArrayInteger HOT 1
- Since Mockito 2.1.0 TextBox.setValue(null) does not work anymore HOT 4
- ToggleButton ClassCastException
- What does it mean "Illegal class modifiers" ? HOT 1
- JaCoCo support not working HOT 7
- Better GWT unit testing http://google.github.io/gwtmockito hyperLink HOT 2
- Provide an example in the samples or documentation for doing code coverage HOT 1
- #68 broke the build HOT 1
- Java 9 support HOT 2
- gwtmockito and GXT HOT 1
- Java 10 upgrade: java.lang.IllegalStateException HOT 3
- javassist 3.22.0-GA breaks gwtmockito ("class is frozen") HOT 3
- Mockito failure with Java11 HOT 1
- gwtmockito v1.1.9 is not available in public repos HOT 3
- IllegalAccessError when using GwtMockitoTestRunner
- Release 1.1.9 is incomplete in maven repository HOT 1
- ClassCastException When Calling MenuItem.setTitle HOT 2
- Junit5 support HOT 1
- Problem with Java 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gwtmockito.