Created
September 24, 2012 17:51
-
-
Save itzg/3777275 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 SomeManagedBean { | |
| private ServiceA someService; | |
| public int doSomething() { | |
| ... logic to be tested ... | |
| someService.doSomethingElse(); | |
| } | |
| public void setSomeService(ServiceA someService) { | |
| this.someService = someService; | |
| } | |
| } | |
| } |
This file contains hidden or 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 SomeManagedBeanTest { | |
| @Test | |
| public void doSomethingTest() { | |
| SomeManagedBean testMe = new SomeManagedBean(); | |
| testMe.setSomeService(new MockServiceA()); | |
| int actualResult = testMe.doSomething(); | |
| assertEquals(1, actualResult); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment