{"action":"created","issue":{"url":"https://api.github.com/repos/yegor256/cactoos/issues/942","repository_url":"https://api.github.com/repos/yegor256/cactoos","labels_url":"https://api.github.com/repos/yegor256/cactoos/issues/942/labels{/name}","comments_url":"https://api.github.com/repos/yegor256/cactoos/issues/942/comments","events_url":"https://api.github.com/repos/yegor256/cactoos/issues/942/events","html_url":"https://github.com/yegor256/cactoos/issues/942","id":345079260,"node_id":"MDU6SXNzdWUzNDUwNzkyNjA=","number":942,"title":"TextEnvelope.equals() is broken","user":{"login":"carlosmiranda","id":1917892,"node_id":"MDQ6VXNlcjE5MTc4OTI=","avatar_url":"https://avatars0.githubusercontent.com/u/1917892?v=4","gravatar_id":"","url":"https://api.github.com/users/carlosmiranda","html_url":"https://github.com/carlosmiranda","followers_url":"https://api.github.com/users/carlosmiranda/followers","following_url":"https://api.github.com/users/carlosmiranda/following{/other_user}","gists_url":"https://api.github.com/users/carlosmiranda/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosmiranda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosmiranda/subscriptions","organizations_url":"https://api.github.com/users/carlosmiranda/orgs","repos_url":"https://api.github.com/users/carlosmiranda/repos","events_url":"https://api.github.com/users/carlosmiranda/events{/privacy}","received_events_url":"https://api.github.com/users/carlosmiranda/received_events","type":"User","site_admin":false},"labels":[{"id":611498887,"node_id":"MDU6TGFiZWw2MTE0OTg4ODc=","url":"https://api.github.com/repos/yegor256/cactoos/labels/bug","name":"bug","color":"ee0701","default":true},{"id":817650738,"node_id":"MDU6TGFiZWw4MTc2NTA3Mzg=","url":"https://api.github.com/repos/yegor256/cactoos/labels/scope","name":"scope","color":"3a6622","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-07-27T03:36:43Z","updated_at":"2018-07-28T17:46:47Z","closed_at":null,"author_association":"NONE","body":"This little gem of a test fails:\r\n\r\n```java\r\n@Test\r\npublic void textMatchesItself() {\r\n        final Text a = new TextOf(\"a\");\r\n        MatcherAssert.assertThat(a, Matchers.is(a));\r\n}\r\n```\r\n\r\nResult:\r\n```\r\njava.lang.AssertionError: \r\nExpected: is <a>\r\n     but: was <a>\r\nExpected :is <a>\r\n     \r\nActual   :<a>\r\n```\r\n\r\nThis works:\r\n```java\r\n@Test\r\npublic void textMatchesStringWithSameValue() {\r\n        final Text a = new TextOf(\"a\");\r\n        MatcherAssert.assertThat(a, Matchers.is(\"a\"));\r\n}\r\n```\r\nIn both cases, this is wrong, because it violates [two important properties](https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals(java.lang.Object)) of `equals()`:\r\n\r\n> * It is _reflexive_: for any non-null reference value x, x.equals(x) should return true.\r\n* Violated in the first case\r\n\r\n> * It is _symmetric_: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.\r\n* Violated in the second case, because `new TextOf(\"a\").equals(\"a\")` returns `true`, but `\"a\".equals(new TextOf(\"a\"))` returns `false`."},"comment":{"url":"https://api.github.com/repos/yegor256/cactoos/issues/comments/408624138","html_url":"https://github.com/yegor256/cactoos/issues/942#issuecomment-408624138","issue_url":"https://api.github.com/repos/yegor256/cactoos/issues/942","id":408624138,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODYyNDEzOA==","user":{"login":"0crat","id":24387511,"node_id":"MDQ6VXNlcjI0Mzg3NTEx","avatar_url":"https://avatars1.githubusercontent.com/u/24387511?v=4","gravatar_id":"","url":"https://api.github.com/users/0crat","html_url":"https://github.com/0crat","followers_url":"https://api.github.com/users/0crat/followers","following_url":"https://api.github.com/users/0crat/following{/other_user}","gists_url":"https://api.github.com/users/0crat/gists{/gist_id}","starred_url":"https://api.github.com/users/0crat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0crat/subscriptions","organizations_url":"https://api.github.com/users/0crat/orgs","repos_url":"https://api.github.com/users/0crat/repos","events_url":"https://api.github.com/users/0crat/events{/privacy}","received_events_url":"https://api.github.com/users/0crat/received_events","type":"User","site_admin":false},"created_at":"2018-07-28T17:46:46Z","updated_at":"2018-07-28T17:46:46Z","author_association":"COLLABORATOR","body":"Bug was reported, see [§29](http://www.zerocracy.com/policy.html#29): +15 point(s) just awarded to @carlosmiranda[/z](https://www.0crat.com/u/carlosmiranda)\n\n<!-- https://www.0crat.com/footprint/C63314D6Z/2091749835, version: 0.27.4, hash: ${buildNumber} -->"}}
{"actor":{"display_login":"0crat"}}