在运行我的swagger定义测试时,我得到以下错误:
Stack trace:
org.assertj.core.error.AssertJMultipleFailuresError:
Multiple Failures (1 failure)
-- failure 1 --
[Checking response schema of response '200' of 'GET' operation of path '/api/controller/method/{param}']
Expecting:
<io.swagger.models.properties.ByteArrayProperty@bf0f8c09>
to be exactly an instance of:
<io.swagger.models.properties.StringProperty>
but was an instance of:
<io.swagger.models.properties.ByteArrayProperty>
at ConsumerDrivenValidator.validateProperty(ConsumerDrivenValidator.java:233)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at io.github.robwin.swagger.test.ConsumerDrivenValidator.validateSwagger(ConsumerDrivenValidator.java:90)
at io.github.robwin.swagger.test.SwaggerAssert.satisfiesContract(SwaggerAssert.java:111)
at io.github.robwin.swagger.test.SwaggerAssert.satisfiesContract(SwaggerAssert.java:123)
at com.myapp.api.documentation.MyTestClass.MyTestMethod(MyTestClass.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
'/api/controller/method/{param}':
get:
tags:
- my-controller
summary: photo
operationId: photoUsingGET
produces:
- image/jpeg
parameters:
- name: param
in: path
description: param
required: true
type: integer
format: int64
responses:
'200':
description: OK
schema:
type: string
format: byte
'401':
description: Unauthorized
'403':
description: Forbidden
'404':
description: Not Found
security:
- apiKey: []
deprecated: false
Lorem Ipsum只是印刷和排版行业的虚拟文本。自15世纪以来,Lorem Ipsum一直是行业的标准虚拟文本,当时一个不知名的打印机拿走了一大堆铅字,并将其拼凑成一本铅字标本书。它不仅生存了五个世纪,而且在电子排版的飞跃中,基本上保持不变。它在20世纪60年代随着包含Lorem Ipsum段落的Letraset页的发布而普及,最近还随着包括Lorem Ipsum版本的Aldus PageMaker等桌面出版软件而普及。
在OpenAPI2.0中,作为文件的响应必须具有类型:file
。
responses:
'200':
description: OK
schema:
type: file
更多信息:https://swagger.io/docs/specification/2-0/description-responses/#responsion-that-returns-a-file
Overview AssertJ网站: http://joel-costigliola.github.io/assertj/ JUnit自己的Assert.assertEquals(String message, String expected, String actual); 是公认的烂API,你很难记住三个参数的位置。 所以后来收编了Hamcrest改成一个从左到右的读法,assertThat
AssertJ 是 JAVA 的流畅断言库。 示例代码: // unique entry point to get access to all assertThat methods and utility methods (e.g. entry) import static org.assertj.core.api.Assertions.*; // common assertions assert
我无法使用AssertJ库测试应用程序中的GUI。为了不扩散你程序的所有代码,编写了一个测试程序来显示问题的本质。 以下是对它的测试: 几秒钟后,应用程序抛出异常:
单元测试是针对某个类的测试,又分为将依赖类完全以https://www.wenjiangs.com/doc/epxh4rzu形式隔离的纯单元测试,以及使用真实的依赖类的非纯粹单元测试两类。 1. https://www.wenjiangs.com/doc/epxh4rzu对象(https://www.wenjiangs.com/doc/epxh4rzuito 与 Powerhttps://www.
我尝试检查密码与功能password_verify发布的用户密码和散列从数据库。 首先,我如何生成密码和哈希: 登录时验证: 总是收到密码错误的消息。我阅读了这个php密码\u散列和密码\u验证问题没有匹配,但我手动测试了散列字符串,以验证文本字符串。 哈希字符串:$2y$10$SwSq7OukPpN/QJ8YOdKgquJQ28fQbNY1Q3JdTFnoe。2VxD/D2RXBS 通过电子邮件