{"action":"created","issue":{"url":"https://api.github.com/repos/CompEvol/beast2/issues/532","repository_url":"https://api.github.com/repos/CompEvol/beast2","labels_url":"https://api.github.com/repos/CompEvol/beast2/issues/532/labels{/name}","comments_url":"https://api.github.com/repos/CompEvol/beast2/issues/532/comments","events_url":"https://api.github.com/repos/CompEvol/beast2/issues/532/events","html_url":"https://github.com/CompEvol/beast2/issues/532","id":141788624,"number":532,"title":"Setting up a DeltaExchangeOperator test is non-trivial","user":{"login":"Anaphory","id":1579723,"avatar_url":"https://avatars.githubusercontent.com/u/1579723?v=3","gravatar_id":"","url":"https://api.github.com/users/Anaphory","html_url":"https://github.com/Anaphory","followers_url":"https://api.github.com/users/Anaphory/followers","following_url":"https://api.github.com/users/Anaphory/following{/other_user}","gists_url":"https://api.github.com/users/Anaphory/gists{/gist_id}","starred_url":"https://api.github.com/users/Anaphory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Anaphory/subscriptions","organizations_url":"https://api.github.com/users/Anaphory/orgs","repos_url":"https://api.github.com/users/Anaphory/repos","events_url":"https://api.github.com/users/Anaphory/events{/privacy}","received_events_url":"https://api.github.com/users/Anaphory/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-03-18T06:41:10Z","updated_at":"2016-03-20T19:26:19Z","closed_at":"2016-03-20T19:26:19Z","body":"I am trying to fix a bug in the `DeltaExchangeOperator` and realised that there is no test for that operator. So I assumed that the most simple test I could imagine would be along the following lines.\r\n\r\n\tpublic void testCanOperate() {\r\n\t\tRealParameter parameter = new RealParameter(new Double[] {1., 1., 1., 1.});\r\n\t\tDeltaExchangeOperator d = new DeltaExchangeOperator();\r\n\t\t// An invalid operator should either fail in initByName or make valid proposals\r\n\t\ttry {\r\n\t\t\td.initByName(\"parameter\", parameter);\r\n\t\t} catch (RuntimeException e) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\td.proposal();\t\t\r\n\t}\r\n\r\nThis test does not check correctness or anything, it just assumes that either `initByName` fails or the operator is functional and can propose state changes. Yet this test fails with a `java.lang.NullPointerException`, in `RealParameter.startEditing()` below `proposal`.\r\n\r\nShould it be more complicated than this to set up an operator test?"},"comment":{"url":"https://api.github.com/repos/CompEvol/beast2/issues/comments/198997386","html_url":"https://github.com/CompEvol/beast2/issues/532#issuecomment-198997386","issue_url":"https://api.github.com/repos/CompEvol/beast2/issues/532","id":198997386,"user":{"login":"rbouckaert","id":3612959,"avatar_url":"https://avatars.githubusercontent.com/u/3612959?v=3","gravatar_id":"","url":"https://api.github.com/users/rbouckaert","html_url":"https://github.com/rbouckaert","followers_url":"https://api.github.com/users/rbouckaert/followers","following_url":"https://api.github.com/users/rbouckaert/following{/other_user}","gists_url":"https://api.github.com/users/rbouckaert/gists{/gist_id}","starred_url":"https://api.github.com/users/rbouckaert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbouckaert/subscriptions","organizations_url":"https://api.github.com/users/rbouckaert/orgs","repos_url":"https://api.github.com/users/rbouckaert/repos","events_url":"https://api.github.com/users/rbouckaert/events{/privacy}","received_events_url":"https://api.github.com/users/rbouckaert/received_events","type":"User","site_admin":false},"created_at":"2016-03-20T19:26:19Z","updated_at":"2016-03-20T19:26:19Z","body":"by 508e8a12e4412d040a867ad49615682cfa69d369"}}