Class ResponseContentAssert
-
- All Implemented Interfaces:
-
org.assertj.core.api.Assert,org.assertj.core.api.Descriptable,org.assertj.core.api.ExtensionPoints
public class ResponseContentAssert<SELF extends ResponseContentAssert<SELF, JSON_ASSERT>, JSON_ASSERT extends AbstractJsonNodeAssert<JSON_ASSERT>> extends AbstractAssert<SELF, ResponseEntity<String>>
对于业务结果可以理解为 成功或者失败,业务代码,业务概述,业务数据
CJ
-
-
Field Summary
Fields Modifier and Type Field Description public final WritableAssertionInfoinfo
-
Constructor Summary
Constructors Constructor Description ResponseContentAssert(ResponseEntity<String> actual, Class<JSON_ASSERT> jsonAssertType, ToBusinessResult business)
-
Method Summary
Modifier and Type Method Description final SELFassertSingleHeader(String name, Function1<AbstractStringAssert<?>, Unit> work)断言唯一值 final SELFassertFirstHeader(String name, Function1<AbstractStringAssert<?>, Unit> work)断言第一个值 final SELFassertHeader(String name, Function1<ListAssert<String>, Unit> work)断言某一个头 final SELFassertHeaders(Function1<MapAssert<String, List<String>>, Unit> work)断言整体头 final SELFworkWithHeaders(Function1<HttpHeaders, Unit> work)final SELFisLegalResponse()final SELFisFailedResponse()final SELFisSuccessResponse()final SELFisErrorCodeMatch(String code)final SELFprint()final SELFisListResponse()final JSON_ASSERTasListAssert()final SELFisObjectResponse()final JSON_ASSERTasObject()final JSON_ASSERTasJsonNodeAssert()失败了也可以有结果 final SELFisNullResponse()final RestResourceCollectionAssertasSpringRestCollection()final RestResourceAssertasSpringRest()final <T extends Any> TreadData(Class<T> javaClass)返回数据结果 final <T extends Any> TreadData()final <T extends Any> ObjectAssert<T>asData(Class<T> javaClass)final <T extends Any> TreadFromData(Function1<BusinessResult, T> reader)final <T extends Any> TreadFromEntity(Function1<ResponseEntity<String>, T> reader)-
Methods inherited from class org.assertj.core.api.AbstractAssert
as, as, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, getWritableAssertionInfo, has, hasSameClassAs, hasSameHashCodeAs, hasToString, hashCode, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, overridingErrorMessage, satisfies, satisfies, usingComparator, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnError -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
ResponseContentAssert
ResponseContentAssert(ResponseEntity<String> actual, Class<JSON_ASSERT> jsonAssertType, ToBusinessResult business)
-
-
Method Detail
-
assertSingleHeader
final SELF assertSingleHeader(String name, Function1<AbstractStringAssert<?>, Unit> work)
断言唯一值
- Since:
2.4.0
-
assertFirstHeader
final SELF assertFirstHeader(String name, Function1<AbstractStringAssert<?>, Unit> work)
断言第一个值
- Since:
2.4.0
-
assertHeader
final SELF assertHeader(String name, Function1<ListAssert<String>, Unit> work)
断言某一个头
- Since:
2.4.0
-
assertHeaders
final SELF assertHeaders(Function1<MapAssert<String, List<String>>, Unit> work)
断言整体头
- Since:
2.4.0
-
workWithHeaders
final SELF workWithHeaders(Function1<HttpHeaders, Unit> work)
- Since:
2.4.0
-
isLegalResponse
final SELF isLegalResponse()
- Returns:
这是一个合法的响应
-
isFailedResponse
final SELF isFailedResponse()
- Returns:
是个失败的请求
-
isSuccessResponse
final SELF isSuccessResponse()
- Returns:
是个成功的请求
-
isErrorCodeMatch
final SELF isErrorCodeMatch(String code)
-
isListResponse
final SELF isListResponse()
- Returns:
断言业务结果是数组
-
asListAssert
final JSON_ASSERT asListAssert()
- Returns:
转成数组断言
-
isObjectResponse
final SELF isObjectResponse()
- Returns:
断言业务数据是对象
-
asObject
final JSON_ASSERT asObject()
- Returns:
转成对象断言
-
asJsonNodeAssert
final JSON_ASSERT asJsonNodeAssert()
失败了也可以有结果
- Returns:
转成JsnoNode断言
- Since:
2.0.0
-
isNullResponse
final SELF isNullResponse()
- Returns:
断言业务数据是 null
-
asSpringRestCollection
final RestResourceCollectionAssert asSpringRestCollection()
- Returns:
转成 spring rest 资源集合断言
-
asSpringRest
final RestResourceAssert asSpringRest()
- Returns:
转成 spring rest 单个资源断言
-
readFromData
final <T extends Any> T readFromData(Function1<BusinessResult, T> reader)
-
readFromEntity
final <T extends Any> T readFromEntity(Function1<ResponseEntity<String>, T> reader)
-
-
-
-