|
|
@@ -40,7 +40,7 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isSuccess, "result is success should be true")
|
|
|
XCTAssertNotNil(result.value, "result value should not be nil")
|
|
|
XCTAssertNil(result.data, "result data should be nil")
|
|
|
- XCTAssertNil(result.error, "result error should be nil")
|
|
|
+ XCTAssertTrue(result.error == nil, "result error should be nil")
|
|
|
}
|
|
|
|
|
|
func testThatDataResponseSerializerFailsWhenDataIsNil() {
|
|
|
@@ -54,9 +54,9 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isFailure, "result is failure should be true")
|
|
|
XCTAssertNil(result.value, "result value should be nil")
|
|
|
XCTAssertNil(result.data, "result data should be nil")
|
|
|
- XCTAssertNotNil(result.error, "result error should not be nil")
|
|
|
+ XCTAssertTrue(result.error != nil, "result error should not be nil")
|
|
|
|
|
|
- if let error = result.error {
|
|
|
+ if let error = result.error as? NSError {
|
|
|
XCTAssertEqual(error.domain, Error.Domain, "error domain should match expected value")
|
|
|
XCTAssertEqual(error.code, Error.Code.DataSerializationFailed.rawValue, "error code should match expected value")
|
|
|
} else {
|
|
|
@@ -77,9 +77,9 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isFailure, "result is failure should be true")
|
|
|
XCTAssertNil(result.value, "result value should be nil")
|
|
|
XCTAssertNil(result.data, "result data should be nil")
|
|
|
- XCTAssertNotNil(result.error, "result error should not be nil")
|
|
|
+ XCTAssertTrue(result.error != nil, "result error should not be nil")
|
|
|
|
|
|
- if let error = result.error {
|
|
|
+ if let error = result.error as? NSError {
|
|
|
XCTAssertEqual(error.domain, Error.Domain, "error domain should match expected value")
|
|
|
XCTAssertEqual(error.code, Error.Code.StringSerializationFailed.rawValue, "error code should match expected value")
|
|
|
} else {
|
|
|
@@ -98,7 +98,7 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isSuccess, "result is success should be true")
|
|
|
XCTAssertNotNil(result.value, "result value should not be nil")
|
|
|
XCTAssertNil(result.data, "result data should be nil")
|
|
|
- XCTAssertNil(result.error, "result error should be nil")
|
|
|
+ XCTAssertTrue(result.error == nil, "result error should be nil")
|
|
|
}
|
|
|
|
|
|
func testThatStringResponseSerializerSucceedsWithUTF8DataAndNoProvidedEncoding() {
|
|
|
@@ -112,7 +112,7 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isSuccess, "result is success should be true")
|
|
|
XCTAssertNotNil(result.value, "result value should not be nil")
|
|
|
XCTAssertNil(result.data, "result data should be nil")
|
|
|
- XCTAssertNil(result.error, "result error should be nil")
|
|
|
+ XCTAssertTrue(result.error == nil, "result error should be nil")
|
|
|
}
|
|
|
|
|
|
func testThatStringResponseSerializerSucceedsWithUTF8DataAndUTF8ProvidedEncoding() {
|
|
|
@@ -126,7 +126,7 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isSuccess, "result is success should be true")
|
|
|
XCTAssertNotNil(result.value, "result value should not be nil")
|
|
|
XCTAssertNil(result.data, "result data should be nil")
|
|
|
- XCTAssertNil(result.error, "result error should be nil")
|
|
|
+ XCTAssertTrue(result.error == nil, "result error should be nil")
|
|
|
}
|
|
|
|
|
|
func testThatStringResponseSerializerSucceedsWithUTF8DataUsingResponseTextEncodingName() {
|
|
|
@@ -146,7 +146,7 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isSuccess, "result is success should be true")
|
|
|
XCTAssertNotNil(result.value, "result value should not be nil")
|
|
|
XCTAssertNil(result.data, "result data should be nil")
|
|
|
- XCTAssertNil(result.error, "result error should be nil")
|
|
|
+ XCTAssertTrue(result.error == nil, "result error should be nil")
|
|
|
}
|
|
|
|
|
|
func testThatStringResponseSerializerFailsWithUTF32DataAndUTF8ProvidedEncoding() {
|
|
|
@@ -161,9 +161,9 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isFailure, "result is failure should be true")
|
|
|
XCTAssertNil(result.value, "result value should be nil")
|
|
|
XCTAssertNotNil(result.data, "result data should not be nil")
|
|
|
- XCTAssertNotNil(result.error, "result error should not be nil")
|
|
|
+ XCTAssertTrue(result.error != nil, "result error should not be nil")
|
|
|
|
|
|
- if let error = result.error {
|
|
|
+ if let error = result.error as? NSError {
|
|
|
XCTAssertEqual(error.domain, Error.Domain, "error domain should match expected value")
|
|
|
XCTAssertEqual(error.code, Error.Code.StringSerializationFailed.rawValue, "error code should match expected value")
|
|
|
} else {
|
|
|
@@ -189,9 +189,9 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isFailure, "result is failure should be true")
|
|
|
XCTAssertNil(result.value, "result value should be nil")
|
|
|
XCTAssertNotNil(result.data, "result data should not be nil")
|
|
|
- XCTAssertNotNil(result.error, "result error should not be nil")
|
|
|
+ XCTAssertTrue(result.error != nil, "result error should not be nil")
|
|
|
|
|
|
- if let error = result.error {
|
|
|
+ if let error = result.error as? NSError {
|
|
|
XCTAssertEqual(error.domain, Error.Domain, "error domain should match expected value")
|
|
|
XCTAssertEqual(error.code, Error.Code.StringSerializationFailed.rawValue, "error code should match expected value")
|
|
|
} else {
|
|
|
@@ -212,9 +212,9 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isFailure, "result is failure should be true")
|
|
|
XCTAssertNil(result.value, "result value should be nil")
|
|
|
XCTAssertNil(result.data, "result data should be nil")
|
|
|
- XCTAssertNotNil(result.error, "result error should not be nil")
|
|
|
+ XCTAssertTrue(result.error != nil, "result error should not be nil")
|
|
|
|
|
|
- if let error = result.error {
|
|
|
+ if let error = result.error as? NSError {
|
|
|
XCTAssertEqual(error.domain, Error.Domain, "error domain should match expected value")
|
|
|
XCTAssertEqual(error.code, Error.Code.JSONSerializationFailed.rawValue, "error code should match expected value")
|
|
|
} else {
|
|
|
@@ -233,9 +233,9 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isFailure, "result is failure should be true")
|
|
|
XCTAssertNil(result.value, "result value should be nil")
|
|
|
XCTAssertNotNil(result.data, "result data should not be nil")
|
|
|
- XCTAssertNotNil(result.error, "result error should not be nil")
|
|
|
+ XCTAssertTrue(result.error != nil, "result error should not be nil")
|
|
|
|
|
|
- if let error = result.error {
|
|
|
+ if let error = result.error as? NSError {
|
|
|
XCTAssertEqual(error.domain, NSCocoaErrorDomain, "error domain should match expected value")
|
|
|
XCTAssertEqual(error.code, 3840, "error code should match expected value")
|
|
|
} else {
|
|
|
@@ -255,7 +255,7 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isSuccess, "result is success should be true")
|
|
|
XCTAssertNotNil(result.value, "result value should not be nil")
|
|
|
XCTAssertNil(result.data, "result data should be nil")
|
|
|
- XCTAssertNil(result.error, "result error should be nil")
|
|
|
+ XCTAssertTrue(result.error == nil, "result error should be nil")
|
|
|
}
|
|
|
|
|
|
func testThatJSONResponseSerializerFailsWhenDataIsInvalidJSON() {
|
|
|
@@ -270,9 +270,9 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isFailure, "result is failure should be true")
|
|
|
XCTAssertNil(result.value, "result value should be nil")
|
|
|
XCTAssertNotNil(result.data, "result data should not be nil")
|
|
|
- XCTAssertNotNil(result.error, "result error should not be nil")
|
|
|
+ XCTAssertTrue(result.error != nil, "result error should not be nil")
|
|
|
|
|
|
- if let error = result.error {
|
|
|
+ if let error = result.error as? NSError {
|
|
|
XCTAssertEqual(error.domain, NSCocoaErrorDomain, "error domain should match expected value")
|
|
|
XCTAssertEqual(error.code, 3840, "error code should match expected value")
|
|
|
} else {
|
|
|
@@ -293,9 +293,9 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isFailure, "result is failure should be true")
|
|
|
XCTAssertNil(result.value, "result value should be nil")
|
|
|
XCTAssertNil(result.data, "result data should be nil")
|
|
|
- XCTAssertNotNil(result.error, "result error should not be nil")
|
|
|
+ XCTAssertTrue(result.error != nil, "result error should not be nil")
|
|
|
|
|
|
- if let error = result.error {
|
|
|
+ if let error = result.error as? NSError {
|
|
|
XCTAssertEqual(error.domain, Error.Domain, "error domain should match expected value")
|
|
|
XCTAssertEqual(error.code, Error.Code.PropertyListSerializationFailed.rawValue, "error code should match expected value")
|
|
|
} else {
|
|
|
@@ -314,9 +314,9 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isFailure, "result is failure should be true")
|
|
|
XCTAssertNil(result.value, "result value should be nil")
|
|
|
XCTAssertNotNil(result.data, "result data should not be nil")
|
|
|
- XCTAssertNotNil(result.error, "result error should not be nil")
|
|
|
+ XCTAssertTrue(result.error != nil, "result error should not be nil")
|
|
|
|
|
|
- if let error = result.error {
|
|
|
+ if let error = result.error as? NSError {
|
|
|
XCTAssertEqual(error.domain, NSCocoaErrorDomain, "error domain should match expected value")
|
|
|
XCTAssertEqual(error.code, 3840, "error code should match expected value")
|
|
|
} else {
|
|
|
@@ -336,7 +336,7 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isSuccess, "result is success should be true")
|
|
|
XCTAssertNotNil(result.value, "result value should not be nil")
|
|
|
XCTAssertNil(result.data, "result data should be nil")
|
|
|
- XCTAssertNil(result.error, "result error should be nil")
|
|
|
+ XCTAssertTrue(result.error == nil, "result error should be nil")
|
|
|
}
|
|
|
|
|
|
func testThatPropertyListResponseSerializerFailsWhenDataIsInvalidPropertyListData() {
|
|
|
@@ -351,9 +351,9 @@ class ResponseSerializationTestCase: BaseTestCase {
|
|
|
XCTAssertTrue(result.isFailure, "result is failure should be true")
|
|
|
XCTAssertNil(result.value, "result value should be nil")
|
|
|
XCTAssertNotNil(result.data, "result data should not be nil")
|
|
|
- XCTAssertNotNil(result.error, "result error should not be nil")
|
|
|
+ XCTAssertTrue(result.error != nil, "result error should not be nil")
|
|
|
|
|
|
- if let error = result.error {
|
|
|
+ if let error = result.error as? NSError {
|
|
|
XCTAssertEqual(error.domain, NSCocoaErrorDomain, "error domain should match expected value")
|
|
|
XCTAssertEqual(error.code, 3840, "error code should match expected value")
|
|
|
} else {
|