From 8d33cb718f94bc69f30b53fdebdf8f2ee5ed3ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=91=E6=88=9F?= Date: Fri, 25 Dec 2020 18:13:26 +0800 Subject: [PATCH] test class package should match the class under test --- docs/en-us/doc/use-mock.md | 2 +- docs/zh-cn/doc/use-mock.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en-us/doc/use-mock.md b/docs/en-us/doc/use-mock.md index 98e495c..8eca1a0 100644 --- a/docs/en-us/doc/use-mock.md +++ b/docs/en-us/doc/use-mock.md @@ -7,7 +7,7 @@ Compared with the class-granularity mocking practices of existing mock tools, `T > - Mock non-constructive method, copy the original method definition to the test class, add a parameter of the same type as the caller, and add a `@MockMethod` annotation > - Mock construction method, copy the original method definition to the test class, replace the return value with the constructed type, the method name is arbitrary, and add a `@MockContructor` annotation -> **Note**: There is also a convention in the current version that the name of the test class should be ` + Test`, which is usually the by-default naming convention of Java unit tests. This constraint may be relaxed or removed in future versions of `TestableMock`. +> **Note**: There is also a convention in the current version that the name of the test class should be ` + Test` (and in the same package path), which is usually the by-default naming convention of Java project managed by `Maven` or `Gradle`. This constraint may be relaxed or removed in future versions of `TestableMock`. The detail mock method definition convention is as follows: diff --git a/docs/zh-cn/doc/use-mock.md b/docs/zh-cn/doc/use-mock.md index e5917f7..1d596fa 100644 --- a/docs/zh-cn/doc/use-mock.md +++ b/docs/zh-cn/doc/use-mock.md @@ -7,7 +7,7 @@ > - Mock非构造方法,拷贝原方法定义到测试类,增加一个与调用者类型相同的参数,加`@MockMethod`注解 > - Mock构造方法,拷贝原方法定义到测试类,返回值换成构造的类型,方法名随意,加`@MockContructor`注解 -> **注意**:当前版本还有一项约定是,测试类名称应该为`被测类名+Test`,通常Java单元测试均符合这种惯例。此约定在未来的`TestableMock`版本中可能会被放宽或去除。 +> **注意**:当前版本还有一项约定是,测试类与被测类的包路径应相同,且名称为`被测类名+Test`,通常采用`Maven`或`Gradle`构建的Java项目符合这种惯例。此约定在未来的`TestableMock`版本中可能会被放宽或去除。 具体的Mock方法定义约定如下: