add upgrade guide for 0.7.0

This commit is contained in:
金戟 2021-11-07 11:06:37 +08:00
parent c2d456da97
commit 548d7ba21f
3 changed files with 19 additions and 1 deletions

View File

@ -9,7 +9,7 @@
阅读[这里](https://mp.weixin.qq.com/s/KyU6Eu7mDkZU8FspfSqfMw)了解更多故事。
<font size="5">**0.6版本已发布**</font>,从`0.5.x`升级到`0.6.x`版本请参考[版本升级指南](https://alibaba.github.io/testable-mock/#/zh-cn/doc/upgrade-guide)
<font size="5">**0.7版本已发布**</font>,从`0.6.x`升级到`0.7.x`版本请参考[版本升级指南](https://alibaba.github.io/testable-mock/#/zh-cn/doc/upgrade-guide)
-----

View File

@ -1,6 +1,15 @@
Upgrade Guide
---
#### Upgrade to 0.7
In version `0.7` mock related annotations and methods are renamed, in order to avoid naming conflict and misunderstanding.
1. The `verify()` used for check mock method invocation status has been renamed to `verifyInvoked()`, as there are several static methods also named `verify()` in `com.sun` package.
2. The annotation `@MockMethod` and `@MockConstructor` used for mark mock replacement method has been renamed to `@MockInvoke` and `@MockNew`, which is more suitable for its real usage.
The usage of those annotations and method has no change for below and above version `0.7.0`, so during the upgrading only rename is required.
### Upgrade to v0.6
In version `0.6``TestableMock` provided a new [quick complicated class construction](en-us/doc/omni-constructor.md) capability. Meanwhile, it includes a modification that is incompatible with the `0.5` version: class `PrivateAccessor` have been moved from `com.alibaba.testable.core.accessor` package to `com.alibaba.testable.core.tool` package.

View File

@ -1,6 +1,15 @@
版本升级说明
---
#### 升级到0.7.x版本
在`0.7`版本重命名了Mock相关的注解和方法以避免命名冲突和由于名字带来的理解歧义包括两部分变化。
1. 用于验证Mock方法调用的`verify()`方法与包括`com.sun`包在内的多个JVM内置静态方法重名在IDE自动添加`import`时会有误选的情况,该方法在新版本中更名为`verifyInvoked()`,同时所属的类型更名为`InvocationVerifier`。
2. 注解`@MockMethod`和`@MockConstructor`的实际作用是对方法调用和New操作进行Mock而其名称容易使人误解为是对方法和构造器本身进行了Mock在新版本中这两个注解分别已被分别更名为`@MockInvoke`和`@MockNew`。
这些注解和方法的使用与之前版本并无差异,从`0.6.x`版本升级到`0.7.0`及以上版本时,请全局替换相关名称即可。
### 升级到0.6.x版本
在`0.6`版本中,`TestableMock`提供了[快速构造复杂参数对象](zh-cn/doc/omni-constructor.md)的能力,同时包含一处与`0.5`版本不兼容的修改,`PrivateAccessor`类型的包路径从`com.alibaba.testable.core.accessor`移到了`com.alibaba.testable.core.tool`。