Hi,
If I understand correctly, you want to disable contract checking on
some classes, since they are generated via JMockit, right?
If you just want to disable all contracts, just don't include the Java
agent when testing?
But there's also a mostly undocumented feature of Cofoja that lets you
bypass contracts on classes matching a given import pattern (e.g.,
com.google.*). There are various methods in RuntimeContractEnvironment
that let you set up your filters; you get an object of that class as
part of Cofoja initialization, if you provide the runtime with a
com.google.java.contract.configurator JVM property.
So, step by step:
1. Write a configurator class, which is loaded and called when Cofoja
is initialized; the most basic example of one can be found in
com.google.java.contract.tests.Cofoja; it needs to implement
com.google.java.contract.ContractEnvironmentConfigurator.
2. Pass the fully-qualified name of that class to the Java agen as the
com.google.java.contract.configurator JVM property. If you're using
the command-line, it should be:
-Dcom.google.java.contract.configurator=your.company.package.YourClass
3. In the configurator's configure() method, you'll get an environment
argument that you can use to disable contracts on classes of your
choice. You want to call
com.google.java.contract.core.runtime.RuntimeContractEnvironment.ignore()
with the pattern of the class names jmockit generates.
The only problem being I don't know whether jmockit generates classes
with reliable class names to blacklist.
Nhat
> --
> You received this message because you are subscribed to the Google Groups
> "cofoja" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
cofoja+un...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>