Created
October 23, 2010 14:32
-
-
Save searls/642277 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
package searls.dougu.examples; | |
import static org.mockito.Mockito.*; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.mockito.InjectMocks; | |
import org.mockito.Mock; | |
import org.mockito.runners.MockitoJUnitRunner; | |
@RunWith(MockitoJUnitRunner.class) | |
public class ShardsOGlassSalesmanTest { | |
@InjectMocks private ShardsOGlassSalesman sut = new ShardsOGlassSalesman(); | |
@Mock private BoxOfGlassPops boxOfGlassPops; | |
@Mock private Wallet wallet; | |
@Mock private ShardsOGlassPop shardsOGlassPop; | |
@Test | |
public void eachSaleShouldPutFiveDollarsInWallet() { | |
when(boxOfGlassPops.retrieve()).thenReturn(shardsOGlassPop); | |
sut.sellGlassPops(1); | |
verify(wallet).insertDollars(5); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment