{"id":12679,"date":"2013-09-07T13:33:00","date_gmt":"2013-09-07T12:33:00","guid":{"rendered":"https:\/\/touk.pl\/blog\/?guid=297e250bfe7ef5e9a268dd545ebcebd7"},"modified":"2022-08-02T11:48:57","modified_gmt":"2022-08-02T09:48:57","slug":"spock-basics","status":"publish","type":"post","link":"https:\/\/touk.pl\/blog\/2013\/09\/07\/spock-basics\/","title":{"rendered":"Spock basics"},"content":{"rendered":"<div style=\"text-align: justify\">Spock (<a href=\"https:\/\/code.google.com\/p\/spock\/\">homepage<\/a>) is like its authors say &#8216;testing and specification framework&#8217;. Spock combines very elegant and natural syntax with the powerful capabilities. And what is most important it is easy to use.<\/div>\n<div><\/div>\n<div>One note at the very beginning: I assume that you are already familiar with principles of Test Driven Development and you know how to use testing framework like for example JUnit.<\/div>\n<h3 id=\"so-how-can-i-start\">So how can I start?<\/h3>\n<div><span style=\"text-align: justify\">\u00a0<\/span><\/div>\n<div style=\"text-align: justify\">Writing spock specifications is very easy. We need basic configuration of Spock and Groovy dependencies (if you are using mavenized project with Eclipse look to my previous post:\u00a0<a href=\"http:\/\/www.rnowak.info\/2013\/08\/spock-java-and-maven.html\">Spock, Java and Maven<\/a>). Once we have everything set up and running smooth we can write our first specs (spec or specification is equivalent for test class in other frameworks like JUnit of TestNG). What is great with Spock is fact that we can use it to test both Groovy projects and pure Java projects or even mixed projects.<\/div>\n<h3 id=\"lets-go\">Let&#8217;s go!<\/h3>\n<div>\n<div style=\"text-align: justify\">Every spec class must inherit from spock.lang.Specification class. Only then test runner will recognize it as test class and start tests. We will write few specs for this simple class:\u00a0<a href=\"https:\/\/github.com\/rafalnowak\/webtex\/blob\/master\/src\/main\/java\/info\/rnowak\/webtex\/domain\/entity\/User.java\">User class<\/a>\u00a0and few tests not connected with this particular class.<\/div>\n<\/div>\n<div>\n<div style=\"text-align: justify\"><\/div>\n<div style=\"text-align: justify\">We start with defining our class:<\/div>\n<\/div>\n<div style=\"text-align: justify\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">import spock.lang.*\r\n\r\nclass UserSpec extends Specification {\r\n\r\n}\r\n<\/pre>\n<p>Now we can proceed to defining test fixtures and test methods.<\/p>\n<\/div>\n<div style=\"text-align: justify\"><\/div>\n<div style=\"text-align: justify\">All activites we want to perform before each test method, are to be put in <b><span style=\"font-family: Courier New, Courier, monospace\">def setup() {&#8230;}<\/span><\/b> method and everything we want to be run after each test should be put in <span style=\"font-family: Courier New, Courier, monospace\"><b>def cleanup() {&#8230;}<\/b><\/span> method (they are equivalents for JUnit methods with @Before and @After annotations).<\/div>\n<div style=\"text-align: justify\"><\/div>\n<div style=\"text-align: justify\">It can look like this:<\/div>\n<div style=\"text-align: justify\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">class UserSpec extends Specification {\r\n    User user\r\n    Document document\r\n\r\n    def setup() {\r\n        user = new User()\r\n        document = DocumentTestFactory.createDocumentWithTitle(\"doc1\")\r\n    }\r\n\r\n    def cleanup() {\r\n\r\n    }\r\n}\r\n<\/pre>\n<p>Of course we can use field initialization for instantiating test objects:<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">class UserSpec extends Specification {\r\n    User user = new User()\r\n    Document document = DocumentTestFactory.createDocumentWithTitle(\"doc1\")\r\n\r\n    def setup() {\r\n\r\n    }\r\n\r\n    def cleanup() {\r\n\r\n    }\r\n}\r\n<\/pre>\n<div style=\"text-align: justify\">What is more readable or preferred? It is just a matter of taste because according to Spock docs behaviour is the same in these two cases.<\/div>\n<div style=\"text-align: justify\"><\/div>\n<div style=\"text-align: justify\">It is worth mentioning that JUnit @BeforeClass\/@AfterClass are also present in Spock as<b> <span style=\"font-family: Courier New, Courier, monospace\">def setupSpec() {&#8230;}<\/span><\/b> and <b><span style=\"font-family: Courier New, Courier, monospace\">def cleanupSpec() {&#8230;}<\/span><\/b>. They will be runned before first test and after last test method.<\/div>\n<h3 id=\"first-tests\">First tests<\/h3>\n<div><\/div>\n<div style=\"text-align: justify\">In Spock every method in specification class, expect setup\/cleanup, is treated by runner as a test method (unless you annotate it with @Ignore).<\/div>\n<div style=\"text-align: justify\"><\/div>\n<div style=\"text-align: justify\">Very interesting feature of Spock and Groovy is ability to name methods with full sentences just like regular strings:<\/div>\n<div style=\"text-align: justify\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">class UserSpec extends Specification {\r\n    \/\/ ...\r\n\r\n    def \"should assign coment to user\"() {\r\n        \/\/ ...\r\n    }\r\n}\r\n<\/pre>\n<p>With such naming convention we can write real specification and include details about specified behaviour in method name, what is very convenient when reading test reports and analyzing errors. Test method (also called feature method) is logically divided into few blocks, each with its own purpose. Blocks are defined like labels in Java (but they are transformed with Groovy AST transform features) and some of them must be put in code in specific order. Most basic and common schema for Spock test is:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">class UserSpec extends Specification {\r\n    \/\/ ...\r\n\r\n    def \"should assign coment to user\"() {\r\n        given:\r\n            \/\/ do initialization of test objects\r\n        when:\r\n            \/\/ perform actions to be tested\r\n        then:\r\n            \/\/ collect and analyze results\r\n    }\r\n}\r\n<\/pre>\n<p>But there are more blocks like:<\/p>\n<ul>\n<li>setup<\/li>\n<li>expect<\/li>\n<li>where<\/li>\n<li>cleanup<\/li>\n<\/ul>\n<p>In next section I am going to describe each block shortly with little examples.<\/p>\n<h4 id=\"given-block\">given block<\/h4>\n<div>This block is used to setup test objects and their state. It has to be first block in test and cannot be repeated. Below is little example how can it be used:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">class UserSpec extends Specification {\r\n    \/\/ ...\r\n    \r\n    def \"should add project to user and mark user as project's owner\"() {\r\n        given:\r\n            User user = new User()\r\n            Project project = ProjectTestFactory.createProjectWithName(\"simple project\")\r\n        \/\/ ...\r\n    }\r\n}\r\n<\/pre>\n<p>In this code<\/p>\n<p><b>given<\/b> block contains initialization of test objects and nothing more. We create simple user without any specified attributes and project with given name. In case when some of these objects could be reused in more feature methods, it could be worth putting initialization in <b>setup <\/b>method.<\/p>\n<h4 id=\"when-and-then-blocks\">when and then blocks<\/h4>\n<\/div>\n<div><b>When<\/b> block contains action we want to test (Spock documentation calls it &#8216;stimulus&#8217;). This block always occurs in pair with <b>then<\/b>\u00a0block, where we are verifying response for satisfying certain conditions. Assume we have this simple test case:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">class UserSpec extends Specification {\r\n    \/\/ ...\r\n    \r\n    def \"should assign user to comment when adding comment to user\"() {\r\n        given:\r\n            User user = new User()\r\n            Comment comment = new Comment()\r\n        when:\r\n            user.addComment(comment)\r\n        then:\r\n            comment.getUserWhoCreatedComment().equals(user)\r\n    }\r\n\r\n    \/\/ ...\r\n}<\/pre>\n<p>In<\/p>\n<p><b>when<\/b>\u00a0block there is a call of tested method and nothing more. After we are sure our action was performed, we can check for desired conditions in <b>then<\/b>\u00a0block. <b> <\/b><b>Then<\/b>\u00a0block is very well structured and its every line is treated by Spock as boolean statement. That means, Spock expects that we write instructions containing comparisons and expressions returning true or false, so we can create <b>then<\/b>\u00a0block with such statements:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">user.getName() == \"John\"\r\nuser.getAge() == 40\r\n!user.isEnabled()<\/pre>\n<p>Each of lines will be treated as single assertion and will be evaluated by Spock.<\/p>\n<p>Sometimes we expect that our method throws an exception under given circumstances. We can write test for it with use of <b>thrown<\/b>\u00a0method:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">class CommentSpec extends Specification {\r\n    def \"should throw exception when adding null document to comment\"() {\r\n        given:\r\n            Comment comment = new Comment()\r\n        when:\r\n            comment.setCommentedDocument(null)\r\n        then:\r\n            thrown(RuntimeException)\r\n    }\r\n}\r\n<\/pre>\n<p><span style=\"font-family: inherit\">In this test we want to make sure that passing incorrect parameters is correctly handled by tested method and that method throws an exception in response. In case you want to be certain that method does not throw particular exception, simply use <\/span><b><span style=\"font-family: Courier New, Courier, monospace\">notThrown<\/span><\/b><span style=\"font-family: inherit\"> method.<\/span><\/p>\n<h4 id=\"expect-block\"><span style=\"font-family: inherit\">expect block<\/span><\/h4>\n<div><span style=\"font-family: inherit\">Expect block is primarily used when we do not want to separate when and then blocks because it is unnatural. It is especially useful for simple test (and according to TDD rules all test should be simple and short) with only one condition to check, like in this example (it is simple but should show the idea):<\/span><\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">def \"should create user with given name\"() {\r\n    given:\r\n        User user = UserTestFactory.createUser(\"john doe\")\r\n    expect:\r\n        user.getName() == \"john doe\"\r\n}\r\n<\/pre>\n<h3 id=\"more-blocks\"><span style=\"font-family: inherit\">More blocks!<\/span><\/h3>\n<p><span style=\"font-family: inherit\">That were very simple tests with standard Spock test layout and canonical divide into given\/when\/then parts. But Spock offers more possibilities in writing tests and provides more blocks.<\/span><\/p>\n<h4 id=\"setup-cleanup-blocks\"><span style=\"font-family: inherit\">setup\/cleanup blocks<\/span><\/h4>\n<div><span style=\"font-family: inherit\">These two blocks have the very same functionality as the\u00a0<\/span><b><span style=\"font-family: Courier New, Courier, monospace\">def setup<\/span><\/b><span style=\"font-family: inherit\">\u00a0and\u00a0<\/span><b><span style=\"font-family: Courier New, Courier, monospace\">def cleanup<\/span><\/b><span style=\"font-family: inherit\">\u00a0methods in specification. They allow to perform some actions before test and after test. But unlike these methods (which are shared between all tests) blocks work only in methods they are defined in.\u00a0<\/span><span style=\"font-family: inherit\">\u00a0<\/span><\/div>\n<h4 id=\"where-easy-way-to-create-readable-parameterized-tests\"><span style=\"font-family: inherit\">where &#8211; easy way to create readable\u00a0<\/span>parameterized<span style=\"font-family: inherit\">\u00a0tests<\/span><\/h4>\n<div><span style=\"font-family: inherit\">Very often when we create unit tests there is a need to &#8220;feed&#8221; them with sample data to test various cases and border values. With Spock this task is very easy and straighforward. To provide test data to\u00a0<\/span>feature method<span style=\"font-family: inherit\">, we need to use <\/span><b style=\"font-family: inherit\">where<\/b><span style=\"font-family: inherit\">\u00a0block. Let&#8217;s take a look at little the piece of code:<\/span><\/div>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">def \"should successfully validate emails with valid syntax\"() {\r\n    expect:\r\n        emailValidator.validate(email) == true\r\n    where:\r\n        email &lt;&lt; [ \"test@test.com\", \"foo@bar.com\" ]\r\n}\r\n<\/pre>\n<p><span style=\"font-family: inherit\">In this example, Spock creates variable called <b>email<\/b>\u00a0which is used when calling method being tested. Internally feature method is called once, but framework iterates over given values and calls <b>expect\/when<\/b>\u00a0block as many times as there are values (however, if we use @Unroll annotation Spock can create separate run for each of given values, more about it in one of next examples).<\/span> <span style=\"font-family: inherit\"> Now, lets assume that we want our feature method to test both successful and failure validations. To achieve that goal we can create few\u00a0<\/span>parameterized<span style=\"font-family: inherit\">\u00a0variables for both input parameter and expected result. Here is a little example:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">def \"should perform validation of email addresses\"() {\r\n    expect:\r\n        emailValidator.validate(email) == result\r\n    where:\r\n        email &lt;&lt; [ \"WTF\", \"@domain\", \"foo@bar.com\" \"a@test\" \r\n        result &lt;&lt; [ false, false, true, false ]\r\n}\r\n<\/pre>\n<p><span style=\"font-family: inherit\">Well, it looks nice, but Spock can do much better. It offers tabular format of defining parameters for test what is much more readable and natural. Lets take a look:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">def \"should perform validation of email addresses\"() {\r\n    expect:\r\n        emailValidator.validate(email) == result\r\n    where:\r\n        email           | result\r\n        \"WTF\"           | false\r\n        \"@domain\"       | false\r\n        \"foo@bar.com\"   | true\r\n        \"a@test\"        | false\r\n}\r\n<\/pre>\n<p>In this code, each column of our &#8220;table&#8221; is treated as a separate variable and rows are values for subsequent test iterations. Another useful feature of Spock during parameterizing test is its ability to &#8220;unroll&#8221; each parameterized test. Feature method from previous example could be defined as (the body stays the same, so I do not repeat it):<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"groovy\">@Unroll(\"should validate email #email\")\r\ndef \"should perform validation of email addresses\"() {\r\n    \/\/ ...\r\n}\r\n<\/pre>\n<p>With that annotation, Spock generate few methods each with its own name and run them separately. We can use symbols from<\/p>\n<p><b>where<\/b>\u00a0blocks in @Unroll argument by preceding it with <b>&#8216;#&#8217;<\/b>\u00a0sign what is a signal to Spock to use it in generated method name.<\/p>\n<h3 id=\"what-next\"><span style=\"font-family: inherit\">What next?<\/span><\/h3>\n<div><span style=\"font-family: inherit\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: inherit\">Well, that was just quick and short journey \u00a0through Spock and its capabilities. However, with that basic tutorial you are ready to write many unit tests. In one of my future posts I am going to describe more features of Spock focusing especially on its mocking abilities.<\/span><\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"Spock (homepage) is like its authors say &#8216;testing and specification framework&#8217;. Spock combines very elegant and natural syntax with the powerful capabilities. And what is most important it is easy to use.\n\nOne note at the very beginning: I assume that you are already familiar with principles of Test Driven Development and you know how to use testing framework like for example JUnit.\n\nSo how can I start?\n\nWriting spock specifications is very easy. We need basic configuration of Spock and Groovy dependencies (if you are using mavenized project with Eclipse look to my previous post:&nbsp;Spock, Java and Maven). Once we have everything set up and running smooth we can write our first specs (spec or specification is equivalent for test class in other frameworks like JUnit of TestNG).\nWhat is great with Spock is fact that we can use it to test both Groovy projects and pure Java projects or even mixed projects.\n\nLet&#8217;s go!\n\nEvery spec class must inherit from spock.lang.Specification class. Only then test runner will recognize it as test class and start tests. We will write few specs for this simple class:&nbsp;User class&nbsp;and few tests not connected with this particular class.\n\n\n\nWe start with defining our class:\n\n\nimport spock.lang.*class UserSpec extends Specification {}\n Now we can proceed to defining test fixtures and test methods.\n\nAll activites we want to perform before each test method, are to be put in def setup() {&#8230;} method and everything we want to be run after each test should be put in def cleanup() {&#8230;} method (they are equivalents for JUnit methods with @Before and @After annotations).\n\nIt can look like this:\n\nclass UserSpec extends Specification {    User user    Document document    def setup() {        user = new User()        document = DocumentTestFactory.createDocumentWithTitle(\"doc1\")    }    def cleanup() {    }}\n Of course we can use field initialization for instantiating test objects:\nclass UserSpec extends Specification {    User user = new User()    Document document = DocumentTestFactory.createDocumentWithTitle(\"doc1\")    def setup() {    }    def cleanup() {    }}\n\nWhat is more readable or preferred? It is just a matter of taste because according to Spock docs behaviour is the same in these two cases.\n\nIt is worth mentioning that JUnit @BeforeClass\/@AfterClass are also present in Spock as def setupSpec() {&#8230;} and def cleanupSpec() {&#8230;}. They will be runned before first test and after last test method.\n\n\n\nFirst tests\n\nIn Spock every method in specification class, expect setup\/cleanup, is treated by runner as a test method (unless you annotate it with @Ignore).\n\nVery interesting feature of Spock and Groovy is ability to name methods with full sentences just like regular strings:\n\nclass UserSpec extends Specification {    \/\/ ...    def \"should assign coment to user\"() {        \/\/ ...    }}\n With such naming convention we can write real specification and include details about specified behaviour in method name, what is very convenient when reading test reports and analyzing errors.\nTest method (also called feature method) is logically divided into few blocks, each with its own purpose. Blocks are defined like labels in Java (but they are transformed with Groovy AST transform features) and some of them must be put in code in specific order.\nMost basic and common schema for Spock test is:\nclass UserSpec extends Specification {    \/\/ ...    def \"should assign coment to user\"() {        given:            \/\/ do initialization of test objects        when:            \/\/ perform actions to be tested        then:            \/\/ collect and analyze results    }}\nBut there are more blocks like:\n\nsetup\nexpect\nwhere\ncleanup\n\nIn next section I am going to describe each block shortly with little examples.\ngiven block\nThis block is used to setup test objects and their state. It has to be first block in test and cannot be repeated. Below is little example how can it be used:\nclass UserSpec extends Specification {    \/\/ ...    def \"should add project to user and mark user as project's owner\"() {        given:            User user = new User()            Project project = ProjectTestFactory.createProjectWithName(\"simple project\")        \/\/ ...    }}\nIn this code given block contains initialization of test objects and nothing more. We create simple user without any specified attributes and project with given name. In case when some of these objects could be reused in more feature methods, it could be worth putting initialization in setup method.\nwhen and then blocks\n\nWhen block contains action we want to test (Spock documentation calls it &#8216;stimulus&#8217;). This block always occurs in pair with then&nbsp;block, where we are verifying response for satisfying certain conditions. Assume we have this simple test case:\nclass UserSpec extends Specification {    \/\/ ...    def \"should assign user to comment when adding comment to user\"() {        given:            User user = new User()            Comment comment = new Comment()        when:            user.addComment(comment)        then:            comment.getUserWhoCreatedComment().equals(user)    }    \/\/ ...}\nIn when&nbsp;block there is a call of tested method and nothing more. After we are sure our action was performed, we can check for desired conditions in then&nbsp;block.Then&nbsp;block is very well structured and its every line is treated by Spock as boolean statement. That means, Spock expects that we write instructions containing comparisons and expressions returning true or false, so we can create then&nbsp;block with such statements:\nuser.getName() == \"John\"user.getAge() == 40!user.isEnabled()\n Each of lines will be treated as single assertion and will be evaluated by Spock.Sometimes we expect that our method throws an exception under given circumstances. We can write test for it with use of thrown&nbsp;method:\nclass CommentSpec extends Specification {    def \"should throw exception when adding null document to comment\"() {        given:            Comment comment = new Comment()        when:            comment.setCommentedDocument(null)        then:            thrown(RuntimeException)    }}\nIn this test we want to make sure that passing incorrect parameters is correctly handled by tested method and that method throws an exception in response. In case you want to be certain that method does not throw particular exception, simply use notThrown method.\nexpect block\nExpect block is primarily used when we do not want to separate when and then blocks because it is unnatural. It is especially useful for simple test (and according to TDD rules all test should be simple and short) with only one condition to check, like in this example (it is simple but should show the idea):\ndef \"should create user with given name\"() {    given:        User user = UserTestFactory.createUser(\"john doe\")    expect:        user.getName() == \"john doe\"}\n\n\n\nMore blocks!\nThat were very simple tests with standard Spock test layout and canonical divide into given\/when\/then parts. But Spock offers more possibilities in writing tests and provides more blocks.\nsetup\/cleanup blocks\nThese two blocks have the very same functionality as the&nbsp;def setup&nbsp;and&nbsp;def cleanup&nbsp;methods in specification. They allow to perform some actions before test and after test. But unlike these methods (which are shared between all tests) blocks work only in methods they are defined in.&nbsp;\n\n\nwhere &#8211; easy way to create readable&nbsp;parameterized&nbsp;tests\nVery often when we create unit tests there is a need to &#8220;feed&#8221; them with sample data to test various cases and border values. With Spock this task is very easy and straighforward. To provide test data to&nbsp;feature method, we need to use where&nbsp;block. Let&#8217;s take a look at little the piece of code:\n\ndef \"should successfully validate emails with valid syntax\"() {    expect:        emailValidator.validate(email) == true    where:        email }\nIn this example, Spock creates variable called email&nbsp;which is used when calling method being tested. Internally feature method is called once, but framework iterates over given values and calls expect\/when&nbsp;block as many times as there are values (however, if we use @Unroll annotation Spock can create separate run for each of given values, more about it in one of next examples).Now, lets assume that we want our feature method to test both successful and failure validations. To achieve that goal we can create few&nbsp;parameterized&nbsp;variables for both input parameter and expected result. Here is a little example:\ndef \"should perform validation of email addresses\"() {    expect:        emailValidator.validate(email) == result    where:        email         result }\nWell, it looks nice, but Spock can do much better. It offers tabular format of defining parameters for test what is much more readable and natural. Lets take a look:\ndef \"should perform validation of email addresses\"() {    expect:        emailValidator.validate(email) == result    where:        email           | result        \"WTF\"           | false        \"@domain\"       | false        \"foo@bar.com\"   | true        \"a@test\"        | false}\nIn this code, each column of our &#8220;table&#8221; is treated as a separate variable and rows are values for subsequent test iterations.\nAnother useful feature of Spock during parameterizing test is its ability to &#8220;unroll&#8221; each parameterized test. Feature method from previous example could be defined as (the body stays the same, so I do not repeat it):\n@Unroll(\"should validate email #email\")def \"should perform validation of email addresses\"() {    \/\/ ...}\n With that annotation, Spock generate few methods each with its own name and run them separately. We can use symbols from where&nbsp;blocks in @Unroll argument by preceding it with &#8216;#&#8217;&nbsp;sign what is a signal to Spock to use it in generated method name.\n\nWhat next?\n\nWell, that was just quick and short journey &nbsp;through Spock and its capabilities. However, with that basic tutorial you are ready to write many unit tests. In one of my future posts I am going to describe more features of Spock focusing especially on its mocking abilities.\n\n\n","protected":false},"author":48,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[50,411,30],"class_list":{"0":"post-12679","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-development-design","7":"tag-groovy","8":"tag-spock","9":"tag-testing"},"_links":{"self":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/12679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/users\/48"}],"replies":[{"embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/comments?post=12679"}],"version-history":[{"count":5,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/12679\/revisions"}],"predecessor-version":[{"id":14815,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/12679\/revisions\/14815"}],"wp:attachment":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/media?parent=12679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/categories?post=12679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/tags?post=12679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}