java - Providing tests as part of a library -


suppose interface like:

public interface fooer {   void foo();   boolean isfooed(); } 

this part of java library i'm writing. users of library supposed implement interface , pass objects library.

i want provide way users test their implementation hold invariants my library code assumes.

following above example:

fooer f = getusersfooer(); f.foo(); // f.isfooed() must return true 

is possible, , if so, feasible or acceptable provide such tests part of library?

(i don't know whether these considered unit tests or integration tests ... test modifications made single method using getter methods or primitive non-mutating methods)

sure, can write classes like

public class testfooer {   public static boolean test(fooer f) {     // ...   } } 

but there "standard way", using usual testing frameworks (junit, ...) ?


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -