{"action":"closed","issue":{"url":"https://api.github.com/repos/stefanbirkner/system-rules/issues/43","repository_url":"https://api.github.com/repos/stefanbirkner/system-rules","labels_url":"https://api.github.com/repos/stefanbirkner/system-rules/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/stefanbirkner/system-rules/issues/43/comments","events_url":"https://api.github.com/repos/stefanbirkner/system-rules/issues/43/events","html_url":"https://github.com/stefanbirkner/system-rules/issues/43","id":169206302,"number":43,"title":"RestoreSystemProperties Rule does not accurately preserve Properties","user":{"login":"shollander","id":4641663,"avatar_url":"https://avatars.githubusercontent.com/u/4641663?v=3","gravatar_id":"","url":"https://api.github.com/users/shollander","html_url":"https://github.com/shollander","followers_url":"https://api.github.com/users/shollander/followers","following_url":"https://api.github.com/users/shollander/following{/other_user}","gists_url":"https://api.github.com/users/shollander/gists{/gist_id}","starred_url":"https://api.github.com/users/shollander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shollander/subscriptions","organizations_url":"https://api.github.com/users/shollander/orgs","repos_url":"https://api.github.com/users/shollander/repos","events_url":"https://api.github.com/users/shollander/events{/privacy}","received_events_url":"https://api.github.com/users/shollander/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/stefanbirkner/system-rules/milestones/17","html_url":"https://github.com/stefanbirkner/system-rules/milestones/1.16.1","labels_url":"https://api.github.com/repos/stefanbirkner/system-rules/milestones/17/labels","id":1978727,"number":17,"title":"1.16.1","description":"","creator":{"login":"stefanbirkner","id":711349,"avatar_url":"https://avatars.githubusercontent.com/u/711349?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanbirkner","html_url":"https://github.com/stefanbirkner","followers_url":"https://api.github.com/users/stefanbirkner/followers","following_url":"https://api.github.com/users/stefanbirkner/following{/other_user}","gists_url":"https://api.github.com/users/stefanbirkner/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanbirkner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanbirkner/subscriptions","organizations_url":"https://api.github.com/users/stefanbirkner/orgs","repos_url":"https://api.github.com/users/stefanbirkner/repos","events_url":"https://api.github.com/users/stefanbirkner/events{/privacy}","received_events_url":"https://api.github.com/users/stefanbirkner/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":1,"state":"open","created_at":"2016-09-01T21:03:17Z","updated_at":"2016-09-04T19:58:33Z","due_on":"2016-09-04T00:00:00Z","closed_at":null},"comments":0,"created_at":"2016-08-03T18:55:16Z","updated_at":"2016-09-04T19:58:33Z","closed_at":"2016-09-04T19:58:33Z","body":"I have encountered a problem with the ```RestoreSystemProperties``` ```Rule```. It modifies the original system properties and causes some of my unit tests to fail. I have done a little debugging and the problem is that the ```before()``` method in ```RestoreSystemProperties.java``` actually changes the existing properties. It appears that it is trying to create a copy, but it actually does not. If you look at the javadoc for [Properties](https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html), the single argument constructor does **not** copy the Properties passed in. Rather it uses those as defaults when properties have not been set. This has different behavior than having the properties set. One example of this is when calling ```contains()``` the Property object will return ```false``` if the property has not been set - even if there is a default for that key.\r\n\r\nI would recommend a simple fix:\r\n```\r\n    protected void before() throws Throwable {\r\n        originalProperties = new Properties();\r\n        originalProperties.pullAll(getProperties());\r\n}\r\n```\r\n"}}
{"actor":{"display_login":"stefanbirkner"}}