summaryrefslogtreecommitdiff
path: root/docs/gmock_for_dummies.md
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2022-04-04 15:30:21 -0700
committerCopybara-Service <copybara-worker@google.com>2022-04-04 15:30:50 -0700
commitc9044ba3dd1cb43dff0bb3c03e588f76e5ceccf6 (patch)
tree16854f38bf280e48db91898368c26b920d3d60b0 /docs/gmock_for_dummies.md
parent137f67e91fb78f15b5407a27e94d9dded8df818c (diff)
downloadgoogletest-git-c9044ba3dd1cb43dff0bb3c03e588f76e5ceccf6.tar.gz
Trying to make it more clear: this is probably not about mock classes, but about mocked classes
PiperOrigin-RevId: 439427291 Change-Id: I3cac035e732fb3fe4f9c314657932a55269e0416
Diffstat (limited to 'docs/gmock_for_dummies.md')
-rw-r--r--docs/gmock_for_dummies.md12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/gmock_for_dummies.md b/docs/gmock_for_dummies.md
index fa1296ee..b7264d35 100644
--- a/docs/gmock_for_dummies.md
+++ b/docs/gmock_for_dummies.md
@@ -190,12 +190,12 @@ Some people put it in a `_test.cc`. This is fine when the interface being mocked
`Foo` changes it, your test could break. (You can't really expect `Foo`'s
maintainer to fix every test that uses `Foo`, can you?)
-Generally, you should not define mock classes you don't own. If you must mock
-such a class owned by others, define the mock class in `Foo`'s Bazel package
-(usually the same directory or a `testing` sub-directory), and put it in a `.h`
-and a `cc_library` with `testonly=True`. Then everyone can reference them from
-their tests. If `Foo` ever changes, there is only one copy of `MockFoo` to
-change, and only tests that depend on the changed methods need to be fixed.
+Generally, you should not mock classes you don't own. If you must mock such a
+class owned by others, define the mock class in `Foo`'s Bazel package (usually
+the same directory or a `testing` sub-directory), and put it in a `.h` and a
+`cc_library` with `testonly=True`. Then everyone can reference them from their
+tests. If `Foo` ever changes, there is only one copy of `MockFoo` to change, and
+only tests that depend on the changed methods need to be fixed.
Another way to do it: you can introduce a thin layer `FooAdaptor` on top of
`Foo` and code to this new interface. Since you own `FooAdaptor`, you can absorb