我正在学习面向方面的编程概念和Spring AOP.我无法理解Pointcut和Joinpoint之间的区别 - 它们对我来说似乎都是一样的.Pointcut是您应用建议的地方,Joinpoint也是我们可以应用我们建议的地方.那有什么区别?
切入点的一个例子可以是:
@Pointcut("execution(* * getName()")
Run Code Online (Sandbox Code Playgroud)
什么是Joinpoint的例子?
我发现有点难以理解如何编写一个jsonpath来告诉我字段中是否存在某些值.
例如:考虑一下这个json:
{
"firstName": "John",
"lastName" : "doe",
"age" : 26,
"address" : {
"streetAddress": "naist street",
"city" : "Nara",
"postalCode" : "630-0192"
},
"phoneNumbers": [
{
"type" : "iPhone",
"number": "0123-4567-8888"
},
{
"type" : "home",
"number": "0123-4567-8910"
}
]
}
Run Code Online (Sandbox Code Playgroud)
如果我写:$ .phoneNumbers [?(@.type.length> 0)]
它给了我这个结果:
'0' ...
'type' => "iPhone"
'number' => "0123-4567-8888"
'1' ...
'type' => "home"
'number' => "0123-4567-8910"
Run Code Online (Sandbox Code Playgroud)
我这样做了:http://jsonpath.com/
因此,如果我想知道在phonenumber中的数字字段中是否有任何值,或者它是否为空,那么我的jsonpath应该是什么?我尝试了各种各样的东西,但无法理解.
谢谢!
我遇到了谷歌真相https://google.github.io/truth/,并考虑尝试一下.我阅读了该网站上的信息,但仍有一个基本问题.
真理是JUnit的替代品吗?我应该如何编写@test方法和测试套件,就像我在JUnit中编写的那样,并通过Jenkins自动执行测试执行?或者说,真理只是让你的断言代码变得美丽而其他一切都保持不变?
Truth还需要JUnit框架(或类似JUnit)的帮助吗?
谢谢!
aop ×1
aspectj ×1
google-truth ×1
json ×1
jsonpath ×1
junit ×1
pointcut ×1
spring ×1
spring-aop ×1
testing ×1
unit-testing ×1