{"id":2532,"date":"2017-04-04T10:18:09","date_gmt":"2017-04-04T06:18:09","guid":{"rendered":"https:\/\/blog.alwawee.ru\/?p=2532"},"modified":"2017-04-04T10:27:49","modified_gmt":"2017-04-04T06:27:49","slug":"ios-unit-test-examples-snippets","status":"publish","type":"post","link":"https:\/\/blog.alwawee.ru\/?p=2532","title":{"rendered":"iOS Unit Test Examples \/ Snippets"},"content":{"rendered":"<p>In this article I will post common iOS Unit testing examples for testing of: <\/p>\n<ol>\n<li>Asynchronous loading of data using REST API<\/li>\n<li>Loading of a UIView<\/li>\n<li>Method call after UITableViewCell is clicked<\/li>\n<li>Static UITableView sections have correct number of rows<\/li>\n<li>Loading of a UIView from UIStoryboard<\/li>\n<li>IBOutlet connection<\/li>\n<li>Model logic<\/li>\n<li>UITableViewCell subclass<\/li>\n<li>IBAction \/ Method is implemented<\/li>\n<li>Testing bundle name<\/li>\n<\/ol>\n<p><strong>Asynchronous loading of data using REST API<\/strong><\/p>\n<pre>\r\n\/\/ Testing REST API GET \/api\/cities\/ that returns an array of cities with id and name\r\n- (void)testCitiesAPI\r\n{\r\n    \/\/ We create XCTestExpectation object to test asynchronous loading\r\n    XCTestExpectation *testExpectation = [self expectationWithDescription:@\"testCitiesAPI\"];\r\n    \r\n    NSString *URLString = [NSString stringWithFormat:@\"\/api\/cities\/\"];\r\n    \r\n    [[RSHTTPClient sharedClient] GET:URLString parameters:nil progress:nil success:^(NSURLSessionTask *task, id responseObject) {\r\n        \r\n        NSArray *jsonArray = (NSArray *)responseObject;\r\n        \r\n        \/\/ Checking that jsonArray is not empty\r\n        XCTAssertNotNil(jsonArray);\r\n        \r\n        for (NSDictionary *dic in jsonArray) {\r\n            RSCity *city = [RSCity objectWithProperties:dic];\r\n            \r\n            \/\/ Checking consistency of a model object created from JSON dic\r\n            XCTAssertNotNil(city.name);\r\n            XCTAssertNotEqual(city.sid, 0);\r\n        }\r\n        \r\n        [testExpectation fulfill];\r\n        \r\n    } failure:^(NSURLSessionTask *task, NSError *error) {\r\n        \r\n        NSLog(@\"Error: %@\", error);\r\n        XCTFail(@\"Error in GET \/api\/cities\/\");\r\n        \r\n    }];\r\n    \r\n    \/\/ Waiting for 10 seconds untim fulfill is called when task is finished\r\n    [self waitForExpectationsWithTimeout:10 handler:^(NSError *error) {\r\n        \r\n    }];\r\n}\r\n<\/pre>\n<p>Here <em>[RSHTTPClient sharedClient]<\/em> is an instance of <em>AFHTTPSessionManager<\/em> subclass. But it doesn&#8217;t matter, the main is the principle.<\/p>\n<p><strong>Loading of a UIView<\/strong><\/p>\n<pre>\r\n@interface RSBaseViewControllerTests : XCTestCase\r\n\r\n@property (nonatomic, strong) RSBaseViewController *vc;\r\n\r\n@end\r\n\r\n@implementation RSBaseViewControllerTests\r\n\r\n- (void)setUp {\r\n    [super setUp];\r\n    \r\n    self.vc = [[RSBaseViewController alloc] init];\r\n    [self.vc view];\r\n}\r\n\r\n- (void)tearDown {\r\n    self.vc = nil;\r\n    [super tearDown];\r\n}\r\n\r\n- (void)testThatViewLoads {\r\n    XCTAssertNotNil(self.vc.view);\r\n}\r\n\r\n@end\r\n<\/pre>\n<p><strong>Method call after UITableViewCell is clicked<\/strong><\/p>\n<pre>\r\n#import \"OCMock.h\"\r\n\r\n# Mock objects for Objective-C\r\npod 'OCMock', '~> 3.4'\r\n\r\n- (void)testThatHomekitRestoreCalled\r\n{\r\n    id mock = [OCMockObject partialMockForObject:self.vc];\r\n    \r\n    [[mock expect] restoreHomeKitClicked];\r\n    \r\n    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:CCSettingsSectionRestoreHomeKit];\r\n    [self.vc tableView:self.vc.tableView didSelectRowAtIndexPath:indexPath];\r\n    \r\n    [mock verify];\r\n}\r\n<\/pre>\n<p>Here we verify that method <em>restoreHomeKitClicked<\/em> is called when user selects a specific row in <em>UITableView<\/em>.<\/p>\n<p><strong>Static UITableView sections have correct number of rows<\/strong><\/p>\n<pre>\r\n- (void)testThatSectionsHaveCorrentNumberOfRows\r\n{\r\n    XCTAssertEqual([self.vc tableView:self.vc.tableView numberOfRowsInSection:CCSettingsSectionUpdate], 1);\r\n    XCTAssertEqual([self.vc tableView:self.vc.tableView numberOfRowsInSection:CCSettingsSectionGeneral], 2);\r\n    XCTAssertEqual([self.vc tableView:self.vc.tableView numberOfRowsInSection:CCSettingsSectionAdditional], 3);\r\n    XCTAssertEqual([self.vc tableView:self.vc.tableView numberOfRowsInSection:CCSettingsSectionRestoreHomeKit], 1);\r\n}\r\n<\/pre>\n<p><strong>Loading of a UIView from UIStoryboard<\/strong><\/p>\n<pre>\r\n- (void)setUp\r\n{\r\n    [super setUp];\r\n    \r\n    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@\"Main\" bundle:nil];\r\n    self.vc = [storyboard instantiateViewControllerWithIdentifier:@\"RECameraListViewController\"];\r\n    [self.vc performSelectorOnMainThread:@selector(loadView) withObject:nil waitUntilDone:YES];\r\n    [self.vc view];\r\n}\r\n\r\n\r\n- (void)tearDown\r\n{\r\n    self.vc = nil;\r\n    [super tearDown];\r\n}\r\n\r\n\r\n#pragma mark - View loading tests\r\n\r\n- (void)testThatViewLoads\r\n{\r\n    XCTAssertNotNil(self.vc.view, @\"View not initiated properly\");\r\n}\r\n\r\n<\/pre>\n<p><strong>IBOutlet connection<\/strong><\/p>\n<pre>\r\n- (void)testOutlets {\r\n    XCTAssertNotNil(self.vc.vkButton);\r\n    XCTAssertNotNil(self.vc.fbButton);\r\n    XCTAssertNotNil(self.vc.googleButton);\r\n    XCTAssertNotNil(self.vc.agreementTextView);\r\n}\r\n<\/pre>\n<p><strong>Model logic<\/strong><\/p>\n<pre>\r\n- (void)testBalanceArrayCount\r\n{\r\n    CSAccount *account = [CSAccount sharedAccount];\r\n    NSArray *balanceArray = [account balanceArrayForNumberOfMonths:12];\r\n    \r\n    XCTAssertEqual([balanceArray count], 13);\r\n}\r\n<\/pre>\n<p>Here we test that an array, that is formed inside our model has correct number of items. Model logic testing obviously can be different depending of logic itself.<\/p>\n<p><strong>UITableViewCell subclass<\/strong><\/p>\n<pre>\r\n- (void)testThatServerCellHasCorrectOutlets\r\n{\r\n    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];\r\n    REServerCell *cell = (REServerCell *)[self.vc tableView:self.vc.tableView cellForRowAtIndexPath:indexPath];\r\n    XCTAssertNotNil(cell.cloudServerLabel, @\"Should connect cloudServerLabel IBOutlet.\");\r\n    XCTAssertNotNil(cell.controlCenterServerLabel, @\"Should connect controlCenterServerLabel IBOutlet.\");\r\n}\r\n\r\n\r\n- (void)testThatServerCellHasCorrectContents\r\n{\r\n    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];\r\n    REServerCell *cell = (REServerCell *)[self.vc tableView:self.vc.tableView cellForRowAtIndexPath:indexPath];\r\n    \r\n    REServerItem *item = self.vc.tableData[0];\r\n    \r\n    NSString *cloudServerURL = cell.cloudServerLabel.text;\r\n    NSString *controlCenterServerURL = cell.controlCenterServerLabel.text;\r\n    \r\n    XCTAssertTrue([cloudServerURL isEqualToString:item.cloudServer]);\r\n    XCTAssertTrue([controlCenterServerURL isEqualToString:item.controlCenterServer]);\r\n}\r\n<\/pre>\n<p><strong>IBAction \/ Method is implemented<\/strong><\/p>\n<pre>\r\n- (void)testThatHelperHasCustomizeAppearanceMethod\r\n{\r\n    XCTAssertTrue([self.helper respondsToSelector:@selector(customizeAppearance)]);\r\n}\r\n<\/pre>\n<p><strong>Testing bundle name<\/strong><\/p>\n<pre>\r\n- (void)testThatBundleNameIsCorrect\r\n{\r\n    NSString *correctBundleName = @\"YourBundleName\";\r\n    NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];\r\n    NSString *bundleName = infoDic[@\"CFBundleName\"];\r\n    XCTAssertTrue([bundleName isEqualToString:correctBundleName], @\"Strings are not equal %@ %@\", correctBundleName, bundleName);\r\n}\r\n<\/pre>\n<p>The last is a rare case, but helps to prevent someone changing a bundle name of project accidentally.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article I will post common iOS Unit testing examples for testing of: Asynchronous loading of data using REST API Loading of a UIView Method call after UITableViewCell is clicked Static UITableView sections have correct number of rows Loading of a UIView from UIStoryboard IBOutlet connection Model logic UITableViewCell subclass IBAction \/ Method is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[187,193,191,192],"class_list":["post-2532","post","type-post","status-publish","format-standard","hentry","category-ios","tag-ios","tag-rest","tag-unit-testing","tag-xctestexpectation"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>iOS Unit Test Examples \/ Snippets - Denis Kutlubaev<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.alwawee.ru\/?p=2532\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"iOS Unit Test Examples \/ Snippets - Denis Kutlubaev\" \/>\n<meta property=\"og:description\" content=\"In this article I will post common iOS Unit testing examples for testing of: Asynchronous loading of data using REST API Loading of a UIView Method call after UITableViewCell is clicked Static UITableView sections have correct number of rows Loading of a UIView from UIStoryboard IBOutlet connection Model logic UITableViewCell subclass IBAction \/ Method is [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.alwawee.ru\/?p=2532\" \/>\n<meta property=\"og:site_name\" content=\"Denis Kutlubaev\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/alwaweemobile\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-04T06:18:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-04T06:27:49+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/blog.alwawee.com\/?attachment_id=1982\" \/>\n<meta name=\"author\" content=\"Denis Kutlubaev\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Denis Kutlubaev\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2532#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2532\"},\"author\":{\"name\":\"Denis Kutlubaev\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#\\\/schema\\\/person\\\/58f1f1f57155b48afab83ba53b3e26a7\"},\"headline\":\"iOS Unit Test Examples \\\/ Snippets\",\"datePublished\":\"2017-04-04T06:18:09+00:00\",\"dateModified\":\"2017-04-04T06:27:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2532\"},\"wordCount\":188,\"commentCount\":1,\"keywords\":[\"iOS\",\"REST\",\"Unit Testing\",\"XCTestExpectation\"],\"articleSection\":[\"iOS\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2532#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2532\",\"url\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2532\",\"name\":\"iOS Unit Test Examples \\\/ Snippets - Denis Kutlubaev\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#website\"},\"datePublished\":\"2017-04-04T06:18:09+00:00\",\"dateModified\":\"2017-04-04T06:27:49+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#\\\/schema\\\/person\\\/58f1f1f57155b48afab83ba53b3e26a7\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2532#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2532\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=2532#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blog.alwawee.ru\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"iOS Unit Test Examples \\\/ Snippets\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#website\",\"url\":\"https:\\\/\\\/blog.alwawee.ru\\\/\",\"name\":\"Denis Kutlubaev\",\"description\":\"iOS Development\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.alwawee.ru\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#\\\/schema\\\/person\\\/58f1f1f57155b48afab83ba53b3e26a7\",\"name\":\"Denis Kutlubaev\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg\",\"caption\":\"Denis Kutlubaev\"},\"description\":\"iOS Developer, creator of Tornado Browser and many other popular apps\",\"sameAs\":[\"http:\\\/\\\/dennis.alwawee.com\"],\"url\":\"https:\\\/\\\/blog.alwawee.ru\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"iOS Unit Test Examples \/ Snippets - Denis Kutlubaev","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.alwawee.ru\/?p=2532","og_locale":"en_US","og_type":"article","og_title":"iOS Unit Test Examples \/ Snippets - Denis Kutlubaev","og_description":"In this article I will post common iOS Unit testing examples for testing of: Asynchronous loading of data using REST API Loading of a UIView Method call after UITableViewCell is clicked Static UITableView sections have correct number of rows Loading of a UIView from UIStoryboard IBOutlet connection Model logic UITableViewCell subclass IBAction \/ Method is [&hellip;]","og_url":"https:\/\/blog.alwawee.ru\/?p=2532","og_site_name":"Denis Kutlubaev","article_publisher":"https:\/\/www.facebook.com\/alwaweemobile","article_published_time":"2017-04-04T06:18:09+00:00","article_modified_time":"2017-04-04T06:27:49+00:00","og_image":[{"url":"http:\/\/blog.alwawee.com\/?attachment_id=1982","type":"","width":"","height":""}],"author":"Denis Kutlubaev","twitter_misc":{"Written by":"Denis Kutlubaev","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.alwawee.ru\/?p=2532#article","isPartOf":{"@id":"https:\/\/blog.alwawee.ru\/?p=2532"},"author":{"name":"Denis Kutlubaev","@id":"https:\/\/blog.alwawee.ru\/#\/schema\/person\/58f1f1f57155b48afab83ba53b3e26a7"},"headline":"iOS Unit Test Examples \/ Snippets","datePublished":"2017-04-04T06:18:09+00:00","dateModified":"2017-04-04T06:27:49+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.alwawee.ru\/?p=2532"},"wordCount":188,"commentCount":1,"keywords":["iOS","REST","Unit Testing","XCTestExpectation"],"articleSection":["iOS"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.alwawee.ru\/?p=2532#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.alwawee.ru\/?p=2532","url":"https:\/\/blog.alwawee.ru\/?p=2532","name":"iOS Unit Test Examples \/ Snippets - Denis Kutlubaev","isPartOf":{"@id":"https:\/\/blog.alwawee.ru\/#website"},"datePublished":"2017-04-04T06:18:09+00:00","dateModified":"2017-04-04T06:27:49+00:00","author":{"@id":"https:\/\/blog.alwawee.ru\/#\/schema\/person\/58f1f1f57155b48afab83ba53b3e26a7"},"breadcrumb":{"@id":"https:\/\/blog.alwawee.ru\/?p=2532#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.alwawee.ru\/?p=2532"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.alwawee.ru\/?p=2532#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.alwawee.ru\/"},{"@type":"ListItem","position":2,"name":"iOS Unit Test Examples \/ Snippets"}]},{"@type":"WebSite","@id":"https:\/\/blog.alwawee.ru\/#website","url":"https:\/\/blog.alwawee.ru\/","name":"Denis Kutlubaev","description":"iOS Development","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.alwawee.ru\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.alwawee.ru\/#\/schema\/person\/58f1f1f57155b48afab83ba53b3e26a7","name":"Denis Kutlubaev","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg","caption":"Denis Kutlubaev"},"description":"iOS Developer, creator of Tornado Browser and many other popular apps","sameAs":["http:\/\/dennis.alwawee.com"],"url":"https:\/\/blog.alwawee.ru\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/posts\/2532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2532"}],"version-history":[{"count":7,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/posts\/2532\/revisions"}],"predecessor-version":[{"id":2539,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/posts\/2532\/revisions\/2539"}],"wp:attachment":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}