diff options
author | Hugo Hudson <hugohudson@google.com> | 2012-02-28 18:09:29 +0000 |
---|---|---|
committer | Hugo Hudson <hugohudson@google.com> | 2012-02-28 18:09:29 +0000 |
commit | 4541568ab5ac306c7dc2b648f7908610868180de (patch) | |
tree | 5cff28d88b5dec5b83e732adbe194ca2ae106403 /tests/com/google | |
parent | 40d40a3f2ebf988f36b828157be56cc12c9c70ac (diff) | |
download | littlemock-4541568ab5ac306c7dc2b648f7908610868180de.tar.gz |
Update to r16 of LittleMock.
Change-Id: Ia270375e8a549709d89a34021d33e22d883b1c25
Diffstat (limited to 'tests/com/google')
-rw-r--r-- | tests/com/google/testing/littlemock/LittleMockTest.java | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/tests/com/google/testing/littlemock/LittleMockTest.java b/tests/com/google/testing/littlemock/LittleMockTest.java index c9b36be..e7f9bca 100644 --- a/tests/com/google/testing/littlemock/LittleMockTest.java +++ b/tests/com/google/testing/littlemock/LittleMockTest.java @@ -1551,15 +1551,18 @@ public class LittleMockTest extends TestCase { } public static class Jim { - public void bob() { + public int bob() { fail(); + return 3; } } // Does not work on JVM, android only. - public void suppress_testMockingConcreteClasses() throws Exception { + public void testMockingConcreteClasses() throws Exception { Jim mock = mock(Jim.class); - mock.bob(); + assertEquals(0, mock.bob()); + doReturn(8).when(mock).bob(); + assertEquals(8, mock.bob()); } private Future<Void> invokeBarMethodAfterLatchAwait(final CountDownLatch countDownLatch) { @@ -1576,17 +1579,6 @@ public class LittleMockTest extends TestCase { // TODO(hugohudson): 5. Every method that throws exceptions could be improved by adding // test for the content of the error message. - // TODO(hugohudson): 5. Add InOrder class, so that we can check that the given methods on - // the given mocks happen in the right order. It will be pretty easy to do. The syntax - // looks like this: - // InOrder inOrder = inOrder(firstMock, secondMock); - // inOrder.verify(firstMock).firstMethod(); - // inOrder.verify(secondMock).secondMethod(); - // This allows us to verify that the calls happened in the desired order. - // By far the simplest way to do this is have a static AtomicInteger on the class which - // indicates exactly when every method call happened, and then just compare order based on - // that. - // TODO(hugohudson): 5. Make the doReturn() method take variable arguments. // The syntax is: // doReturn(1, 2, 3).when(mFoo).anInt(); |