@@ -19,10 +19,10 @@ final class SiteVerticalsRequestEncodingTests: XCTestCase {
1919 XCTAssertNoThrow ( try JSONSerialization . jsonObject ( with: encodedJSON, options: [ ] ) )
2020 let serializedJSON = try ! JSONSerialization . jsonObject ( with: encodedJSON, options: [ ] )
2121
22- if let _ = serializedJSON as? [ String : AnyObject ] { } else {
22+ guard let jsonDictionary = serializedJSON as? [ String : AnyObject ] else {
2323 XCTFail ( " Failed to encode a proper JSON dictionary! " )
24+ return
2425 }
25- let jsonDictionary = serializedJSON as! [ String : AnyObject ]
2626
2727 // Then
2828 let actualSearch = jsonDictionary [ " search " ] as? String
@@ -50,10 +50,10 @@ final class SiteVerticalsRequestEncodingTests: XCTestCase {
5050 XCTAssertNoThrow ( try JSONSerialization . jsonObject ( with: encodedJSON, options: [ ] ) )
5151 let serializedJSON = try ! JSONSerialization . jsonObject ( with: encodedJSON, options: [ ] )
5252
53- if let _ = serializedJSON as? [ String : AnyObject ] { } else {
53+ guard let jsonDictionary = serializedJSON as? [ String : AnyObject ] else {
5454 XCTFail ( " Failed to encode a proper JSON dictionary! " )
55+ return
5556 }
56- let jsonDictionary = serializedJSON as! [ String : AnyObject ]
5757
5858 // Then
5959 let actualSearch = jsonDictionary [ " search " ] as? String
@@ -81,10 +81,10 @@ final class SiteVerticalsRequestEncodingTests: XCTestCase {
8181 XCTAssertNoThrow ( try JSONSerialization . jsonObject ( with: encodedJSON, options: [ ] ) )
8282 let serializedJSON = try ! JSONSerialization . jsonObject ( with: encodedJSON, options: [ ] )
8383
84- if let _ = serializedJSON as? [ String : AnyObject ] { } else {
84+ guard let jsonDictionary = serializedJSON as? [ String : AnyObject ] else {
8585 XCTFail ( " Failed to encode a proper JSON dictionary! " )
86+ return
8687 }
87- let jsonDictionary = serializedJSON as! [ String : AnyObject ]
8888
8989 // Then
9090 let actualSearch = jsonDictionary [ " search " ] as? String
0 commit comments