{"action":"closed","issue":{"url":"https://api.github.com/repos/henri-tremblay/mytest/issues/143","labels_url":"https://api.github.com/repos/henri-tremblay/mytest/issues/143/labels{/name}","comments_url":"https://api.github.com/repos/henri-tremblay/mytest/issues/143/comments","events_url":"https://api.github.com/repos/henri-tremblay/mytest/issues/143/events","html_url":"https://github.com/henri-tremblay/mytest/issues/143","id":83255500,"number":143,"title":"Reset does not seem to be working.","user":{"login":"henri-tremblay","id":1216819,"avatar_url":"https://avatars.githubusercontent.com/u/1216819?v=3","gravatar_id":"","url":"https://api.github.com/users/henri-tremblay","html_url":"https://github.com/henri-tremblay","followers_url":"https://api.github.com/users/henri-tremblay/followers","following_url":"https://api.github.com/users/henri-tremblay/following{/other_user}","gists_url":"https://api.github.com/users/henri-tremblay/gists{/gist_id}","starred_url":"https://api.github.com/users/henri-tremblay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henri-tremblay/subscriptions","organizations_url":"https://api.github.com/users/henri-tremblay/orgs","repos_url":"https://api.github.com/users/henri-tremblay/repos","events_url":"https://api.github.com/users/henri-tremblay/events{/privacy}","received_events_url":"https://api.github.com/users/henri-tremblay/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/henri-tremblay/mytest/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/henri-tremblay/mytest/labels/core","name":"core","color":"f7c6c7"},{"url":"https://api.github.com/repos/henri-tremblay/mytest/labels/major","name":"major","color":"f7c6c7"},{"url":"https://api.github.com/repos/henri-tremblay/mytest/labels/notabug","name":"notabug","color":"bfdadc"}],"state":"closed","locked":false,"assignee":{"login":"henri-tremblay","id":1216819,"avatar_url":"https://avatars.githubusercontent.com/u/1216819?v=3","gravatar_id":"","url":"https://api.github.com/users/henri-tremblay","html_url":"https://github.com/henri-tremblay","followers_url":"https://api.github.com/users/henri-tremblay/followers","following_url":"https://api.github.com/users/henri-tremblay/following{/other_user}","gists_url":"https://api.github.com/users/henri-tremblay/gists{/gist_id}","starred_url":"https://api.github.com/users/henri-tremblay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henri-tremblay/subscriptions","organizations_url":"https://api.github.com/users/henri-tremblay/orgs","repos_url":"https://api.github.com/users/henri-tremblay/repos","events_url":"https://api.github.com/users/henri-tremblay/events{/privacy}","received_events_url":"https://api.github.com/users/henri-tremblay/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-06-01T01:26:46Z","updated_at":"2015-06-01T01:26:47Z","closed_at":"2015-06-01T01:26:47Z","body":"*Migrated from:* CodeHaus issue EASYMOCK-2\n*Original reporter:* Nate Corlet\n\n---------------------------------------------------------\n@Test\r\n@ExpectedException (SupportDatabaseException.class)\r\npublic void testGetConsultantsByUnitExceptions() throws Exception {\r\n\tJdbcTemplate realTemplate = target.getJdbcTemplate();\r\n\tJdbcTemplate jdbcTemplateMock = createMock(\"database\", JdbcTemplate.class);\r\n\ttry {\r\n\t\tSystem.err.println(\"a\");\r\n\t\tList<Consultant> consultants = new ArrayList<Consultant>();\r\n\t\tSystem.err.println(\"b\");\r\n\t\texpect(jdbcTemplateMock.query((String)anyObject(), (Object[])anyObject(), \r\n\t\t\t(int[])anyObject(), (RowMapper)anyObject())).andThrow(new EmptyResultDataAccessException(2));\r\n\t\tSystem.err.println(\"c\");\r\n\t\treplay(jdbcTemplateMock);\r\n\t\tSystem.err.println(\"d\");\r\n\t\ttarget.setJdbcTemplate(jdbcTemplateMock);\r\n\t\tSystem.err.println(\"e\");\r\n\t\tconsultants = target.getByUnitId(\"363774\");\r\n\t\tSystem.err.println(\"f\");\r\n\t\tassertThat(consultants, equalTo(isNull()));\r\n\t\tSystem.err.println(\"g\");\r\n\t\tverify(jdbcTemplateMock);\r\n\t\tSystem.err.println(\"h\");\r\n\t\treset(jdbcTemplateMock);\r\n\t\tSystem.err.println(\"i\");\r\n\t\texpect(jdbcTemplateMock.query((String)anyObject(), (Object[])anyObject(), \r\n\t\t\t(int[])anyObject(), (RowMapper)anyObject())).andThrow(new IllegalArgumentException(\"testGetConsultantsByUnitExceptions Fail.  This is expected.\"));\r\n\t\tSystem.err.println(\"j\");\r\n\t\treplay(jdbcTemplateMock);\r\n\t\tSystem.err.println(\"k\");\r\n\t\ttarget.getByUnitId(\"363774\");\r\n\t\tSystem.err.println(\"l\");\r\n\t} finally {\r\n\t\tSystem.err.println(\"m\");\r\n\t\tSystem.err.println(\"n\");\r\n\t\tverify(jdbcTemplateMock);\r\n\t\tSystem.err.println(\"o\");\r\n\t\ttarget.setJdbcTemplate(realTemplate);\r\n\t\tSystem.err.println(\"p\");\r\n\t}\r\n}\r\n\r\n\r\nThe output from the above is:\r\na\r\nb\r\nc\r\nd\r\ne\r\nf\r\ng\r\nh\r\ni\r\nm\r\nonly once.\r\nn\r\n\r\nYou'll note that it chokes on the second expect, then jumps into the finally where it get's an illegal state.  Thinks it is in replay mode.  This is the only test in the class, so the problem does not exist in any other test method.\n"}}