Created
October 27, 2009 07:09
-
-
Save maeste/219389 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AnotherClass { | |
@TestedBy (class="NullVerifier" method="shouldNotreturnNull") | |
public String anotherMethod(String param); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImpleOne implements IunderTest { | |
public String methodOne() { | |
//implementation.... | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImpleTwo implements IunderTest { | |
public String methodOne() { | |
//implementation.... | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IunderTest { | |
@TestedBy (class="TestClass" method="pippo") | |
@TestedBy (class="NullVerifier" method="shouldNotreturnNull") | |
public String methodOne(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package it.javalinux.testedby.commontests; | |
import static it.javalinux.testedby.factories.ClassUnderTestInstanceFactory.invokeMethodUnderTest; | |
public class NullVerifier { | |
@Test | |
public void shouldNotreturnNull() { | |
Object result = invokeMethodUnderTest(); | |
//assertions on result to be not null | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static it.javalinux.testedby.factories.ClassUnderTestInstanceFactory.createInstance; | |
public class TestClass { | |
@Test | |
public void pippo() { | |
IunderTest ut= createInstance(IunderTest.class); | |
String result = ut.methodOne(); | |
//assertions on result | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment