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 - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -