{"action":"created","comment":{"url":"https://api.github.com/repos/randoop/randoop/pulls/comments/41587879","id":41587879,"diff_hunk":"@@ -195,58 +183,86 @@ public File writeDriverFile(String driverClassName) {\n     return junitTestSuites;\n   }\n   \n-  public static File writeDriverFile(File dir, String packageName, String driverClassName,\n-      List<String> junitTestSuiteNames) {\n-    File file = new File(dir, driverClassName + \".java\");\n+  /*\n+   * writes JUnit4 suite based on list of class names\n+   */\n+  public File writeSuiteFile (List<String> testClassNames) {\n+    File dir = this.getDir();\n+    String suiteClassName = masterTestClassName;\n+    File file = new File(dir, suiteClassName+\".java\");\n     PrintStream out = createTextOutputStream(file);\n     try {\n-      outputPackageName(out, packageName);\n-      out.println(\"import junit.framework.*;\");\n-      out.println(\"import junit.textui.*;\");\n-      out.println(\"\");\n-      out.println(\"public class \" + driverClassName + \" extends TestCase {\");\n-      out.println(\"\");\n-      if (GenInputsAbstract.junit_reflection_allowed) {\n-      out.println(\"  public static void main(String[] args) {\");\n-      } else {\n-      out.println(\"  public static void main(String[] args) throws Throwable {\");\n+      outputPackageName(out,packageName);\n+      \n+      out.println();\n+      out.println(\"import org.junit.runner.RunWith;\");\n+      out.println(\"import org.junit.runners.Suite;\");\n+      out.println();\n+      out.println(\"@RunWith(Suite.class)\");\n+      out.println(\"@Suite.SuiteClasses({\");\n+     \n+      Iterator<String> testIterator = testClassNames.iterator();\n+      if (testIterator.hasNext()) {\n+        out.println(testIterator.next() + \".class\");\n+        while (testIterator.hasNext()) {\n+          out.print(\", \");\n+          out.println(testIterator.next() + \".class\");\n+        }\n       }\n-      if (GenInputsAbstract.init_routine != null)\n-        out.println (\"    \" + GenInputsAbstract.init_routine + \"();\");\n-\n-      if (GenInputsAbstract.junit_reflection_allowed) {\n-      out.println(\"    TestRunner runner = new TestRunner();\");\n-      out.println(\"    TestResult result = runner.doRun(suite(), false);\");\n-      out.println(\"    if (! result.wasSuccessful()) {\");\n-      out.println(\"      System.exit(1);\");\n-      out.println(\"    }\");\n-      } else {\n-      out.println(\"    new \" + driverClassName + \"(\\\"\" + driverClassName + \"\\\").runTest();\");\n+      \n+      out.println(\"})\");\n+      out.println(\"public class \" + suiteClassName + \"{ }\");\n+    } finally {","path":"src/randoop/JunitFileWriter.java","position":237,"original_position":237,"commit_id":"a94159a84712ae776e82ceb09174446c26636cca","original_commit_id":"a94159a84712ae776e82ceb09174446c26636cca","user":{"login":"mernst","id":121025,"avatar_url":"https://avatars.githubusercontent.com/u/121025?v=3","gravatar_id":"","url":"https://api.github.com/users/mernst","html_url":"https://github.com/mernst","followers_url":"https://api.github.com/users/mernst/followers","following_url":"https://api.github.com/users/mernst/following{/other_user}","gists_url":"https://api.github.com/users/mernst/gists{/gist_id}","starred_url":"https://api.github.com/users/mernst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mernst/subscriptions","organizations_url":"https://api.github.com/users/mernst/orgs","repos_url":"https://api.github.com/users/mernst/repos","events_url":"https://api.github.com/users/mernst/events{/privacy}","received_events_url":"https://api.github.com/users/mernst/received_events","type":"User","site_admin":false},"body":"I think a try-with-resources statement would be shorter and easier to read than the try-finally statement.\r\nIt's supported since Java 7, so it is fine to use.  (We are still avoiding use of Java 8 because some users haven't updated, but Java 7 is fair game.)","created_at":"2015-10-09T00:50:45Z","updated_at":"2015-10-09T00:50:45Z","html_url":"https://github.com/randoop/randoop/pull/57#discussion_r41587879","pull_request_url":"https://api.github.com/repos/randoop/randoop/pulls/57","_links":{"self":{"href":"https://api.github.com/repos/randoop/randoop/pulls/comments/41587879"},"html":{"href":"https://github.com/randoop/randoop/pull/57#discussion_r41587879"},"pull_request":{"href":"https://api.github.com/repos/randoop/randoop/pulls/57"}}},"pull_request":{"url":"https://api.github.com/repos/randoop/randoop/pulls/57","id":47195220,"html_url":"https://github.com/randoop/randoop/pull/57","diff_url":"https://github.com/randoop/randoop/pull/57.diff","patch_url":"https://github.com/randoop/randoop/pull/57.patch","issue_url":"https://api.github.com/repos/randoop/randoop/issues/57","number":57,"state":"open","locked":false,"title":"Junit4 generation","user":{"login":"bjkeller","id":5479869,"avatar_url":"https://avatars.githubusercontent.com/u/5479869?v=3","gravatar_id":"","url":"https://api.github.com/users/bjkeller","html_url":"https://github.com/bjkeller","followers_url":"https://api.github.com/users/bjkeller/followers","following_url":"https://api.github.com/users/bjkeller/following{/other_user}","gists_url":"https://api.github.com/users/bjkeller/gists{/gist_id}","starred_url":"https://api.github.com/users/bjkeller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjkeller/subscriptions","organizations_url":"https://api.github.com/users/bjkeller/orgs","repos_url":"https://api.github.com/users/bjkeller/repos","events_url":"https://api.github.com/users/bjkeller/events{/privacy}","received_events_url":"https://api.github.com/users/bjkeller/received_events","type":"User","site_admin":false},"body":"These are changes to transition Randoop to generate JUnit4 tests rather than JUnit3.\r\nThis primarily affects implementors of Check and ObjectContract as well as JunitFileWriter. I pulled the testing of the reflection flag out to GenTest, and now have separate methods for generating a single suite (for reflective case) and driver class (for non-reflective case). There is no longer a static JunitFileWriter.writeDriverFile method.","created_at":"2015-10-08T19:25:20Z","updated_at":"2015-10-09T00:50:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"08895d71b39a069f6a1384c55fa260878c455870","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/randoop/randoop/pulls/57/commits","review_comments_url":"https://api.github.com/repos/randoop/randoop/pulls/57/comments","review_comment_url":"https://api.github.com/repos/randoop/randoop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/randoop/randoop/issues/57/comments","statuses_url":"https://api.github.com/repos/randoop/randoop/statuses/a94159a84712ae776e82ceb09174446c26636cca","head":{"label":"randoop:junit4-generation","ref":"junit4-generation","sha":"a94159a84712ae776e82ceb09174446c26636cca","user":{"login":"randoop","id":15037885,"avatar_url":"https://avatars.githubusercontent.com/u/15037885?v=3","gravatar_id":"","url":"https://api.github.com/users/randoop","html_url":"https://github.com/randoop","followers_url":"https://api.github.com/users/randoop/followers","following_url":"https://api.github.com/users/randoop/following{/other_user}","gists_url":"https://api.github.com/users/randoop/gists{/gist_id}","starred_url":"https://api.github.com/users/randoop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randoop/subscriptions","organizations_url":"https://api.github.com/users/randoop/orgs","repos_url":"https://api.github.com/users/randoop/repos","events_url":"https://api.github.com/users/randoop/events{/privacy}","received_events_url":"https://api.github.com/users/randoop/received_events","type":"Organization","site_admin":false},"repo":{"id":34923107,"name":"randoop","full_name":"randoop/randoop","owner":{"login":"randoop","id":15037885,"avatar_url":"https://avatars.githubusercontent.com/u/15037885?v=3","gravatar_id":"","url":"https://api.github.com/users/randoop","html_url":"https://github.com/randoop","followers_url":"https://api.github.com/users/randoop/followers","following_url":"https://api.github.com/users/randoop/following{/other_user}","gists_url":"https://api.github.com/users/randoop/gists{/gist_id}","starred_url":"https://api.github.com/users/randoop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randoop/subscriptions","organizations_url":"https://api.github.com/users/randoop/orgs","repos_url":"https://api.github.com/users/randoop/repos","events_url":"https://api.github.com/users/randoop/events{/privacy}","received_events_url":"https://api.github.com/users/randoop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/randoop/randoop","description":"Automatic test generation for Java","fork":false,"url":"https://api.github.com/repos/randoop/randoop","forks_url":"https://api.github.com/repos/randoop/randoop/forks","keys_url":"https://api.github.com/repos/randoop/randoop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/randoop/randoop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/randoop/randoop/teams","hooks_url":"https://api.github.com/repos/randoop/randoop/hooks","issue_events_url":"https://api.github.com/repos/randoop/randoop/issues/events{/number}","events_url":"https://api.github.com/repos/randoop/randoop/events","assignees_url":"https://api.github.com/repos/randoop/randoop/assignees{/user}","branches_url":"https://api.github.com/repos/randoop/randoop/branches{/branch}","tags_url":"https://api.github.com/repos/randoop/randoop/tags","blobs_url":"https://api.github.com/repos/randoop/randoop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/randoop/randoop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/randoop/randoop/git/refs{/sha}","trees_url":"https://api.github.com/repos/randoop/randoop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/randoop/randoop/statuses/{sha}","languages_url":"https://api.github.com/repos/randoop/randoop/languages","stargazers_url":"https://api.github.com/repos/randoop/randoop/stargazers","contributors_url":"https://api.github.com/repos/randoop/randoop/contributors","subscribers_url":"https://api.github.com/repos/randoop/randoop/subscribers","subscription_url":"https://api.github.com/repos/randoop/randoop/subscription","commits_url":"https://api.github.com/repos/randoop/randoop/commits{/sha}","git_commits_url":"https://api.github.com/repos/randoop/randoop/git/commits{/sha}","comments_url":"https://api.github.com/repos/randoop/randoop/comments{/number}","issue_comment_url":"https://api.github.com/repos/randoop/randoop/issues/comments{/number}","contents_url":"https://api.github.com/repos/randoop/randoop/contents/{+path}","compare_url":"https://api.github.com/repos/randoop/randoop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/randoop/randoop/merges","archive_url":"https://api.github.com/repos/randoop/randoop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/randoop/randoop/downloads","issues_url":"https://api.github.com/repos/randoop/randoop/issues{/number}","pulls_url":"https://api.github.com/repos/randoop/randoop/pulls{/number}","milestones_url":"https://api.github.com/repos/randoop/randoop/milestones{/number}","notifications_url":"https://api.github.com/repos/randoop/randoop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/randoop/randoop/labels{/name}","releases_url":"https://api.github.com/repos/randoop/randoop/releases{/id}","created_at":"2015-05-01T20:42:29Z","updated_at":"2015-10-08T18:25:28Z","pushed_at":"2015-10-08T23:13:26Z","git_url":"git://github.com/randoop/randoop.git","ssh_url":"git@github.com:randoop/randoop.git","clone_url":"https://github.com/randoop/randoop.git","svn_url":"https://github.com/randoop/randoop","homepage":"http://mernst.github.io/randoop/","size":346512,"stargazers_count":6,"watchers_count":6,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":7,"forks":5,"open_issues":7,"watchers":6,"default_branch":"master"}},"base":{"label":"randoop:master","ref":"master","sha":"b4a923ded5c2958ac559f5e28edf262abfd5d9bf","user":{"login":"randoop","id":15037885,"avatar_url":"https://avatars.githubusercontent.com/u/15037885?v=3","gravatar_id":"","url":"https://api.github.com/users/randoop","html_url":"https://github.com/randoop","followers_url":"https://api.github.com/users/randoop/followers","following_url":"https://api.github.com/users/randoop/following{/other_user}","gists_url":"https://api.github.com/users/randoop/gists{/gist_id}","starred_url":"https://api.github.com/users/randoop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randoop/subscriptions","organizations_url":"https://api.github.com/users/randoop/orgs","repos_url":"https://api.github.com/users/randoop/repos","events_url":"https://api.github.com/users/randoop/events{/privacy}","received_events_url":"https://api.github.com/users/randoop/received_events","type":"Organization","site_admin":false},"repo":{"id":34923107,"name":"randoop","full_name":"randoop/randoop","owner":{"login":"randoop","id":15037885,"avatar_url":"https://avatars.githubusercontent.com/u/15037885?v=3","gravatar_id":"","url":"https://api.github.com/users/randoop","html_url":"https://github.com/randoop","followers_url":"https://api.github.com/users/randoop/followers","following_url":"https://api.github.com/users/randoop/following{/other_user}","gists_url":"https://api.github.com/users/randoop/gists{/gist_id}","starred_url":"https://api.github.com/users/randoop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randoop/subscriptions","organizations_url":"https://api.github.com/users/randoop/orgs","repos_url":"https://api.github.com/users/randoop/repos","events_url":"https://api.github.com/users/randoop/events{/privacy}","received_events_url":"https://api.github.com/users/randoop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/randoop/randoop","description":"Automatic test generation for Java","fork":false,"url":"https://api.github.com/repos/randoop/randoop","forks_url":"https://api.github.com/repos/randoop/randoop/forks","keys_url":"https://api.github.com/repos/randoop/randoop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/randoop/randoop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/randoop/randoop/teams","hooks_url":"https://api.github.com/repos/randoop/randoop/hooks","issue_events_url":"https://api.github.com/repos/randoop/randoop/issues/events{/number}","events_url":"https://api.github.com/repos/randoop/randoop/events","assignees_url":"https://api.github.com/repos/randoop/randoop/assignees{/user}","branches_url":"https://api.github.com/repos/randoop/randoop/branches{/branch}","tags_url":"https://api.github.com/repos/randoop/randoop/tags","blobs_url":"https://api.github.com/repos/randoop/randoop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/randoop/randoop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/randoop/randoop/git/refs{/sha}","trees_url":"https://api.github.com/repos/randoop/randoop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/randoop/randoop/statuses/{sha}","languages_url":"https://api.github.com/repos/randoop/randoop/languages","stargazers_url":"https://api.github.com/repos/randoop/randoop/stargazers","contributors_url":"https://api.github.com/repos/randoop/randoop/contributors","subscribers_url":"https://api.github.com/repos/randoop/randoop/subscribers","subscription_url":"https://api.github.com/repos/randoop/randoop/subscription","commits_url":"https://api.github.com/repos/randoop/randoop/commits{/sha}","git_commits_url":"https://api.github.com/repos/randoop/randoop/git/commits{/sha}","comments_url":"https://api.github.com/repos/randoop/randoop/comments{/number}","issue_comment_url":"https://api.github.com/repos/randoop/randoop/issues/comments{/number}","contents_url":"https://api.github.com/repos/randoop/randoop/contents/{+path}","compare_url":"https://api.github.com/repos/randoop/randoop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/randoop/randoop/merges","archive_url":"https://api.github.com/repos/randoop/randoop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/randoop/randoop/downloads","issues_url":"https://api.github.com/repos/randoop/randoop/issues{/number}","pulls_url":"https://api.github.com/repos/randoop/randoop/pulls{/number}","milestones_url":"https://api.github.com/repos/randoop/randoop/milestones{/number}","notifications_url":"https://api.github.com/repos/randoop/randoop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/randoop/randoop/labels{/name}","releases_url":"https://api.github.com/repos/randoop/randoop/releases{/id}","created_at":"2015-05-01T20:42:29Z","updated_at":"2015-10-08T18:25:28Z","pushed_at":"2015-10-08T23:13:26Z","git_url":"git://github.com/randoop/randoop.git","ssh_url":"git@github.com:randoop/randoop.git","clone_url":"https://github.com/randoop/randoop.git","svn_url":"https://github.com/randoop/randoop","homepage":"http://mernst.github.io/randoop/","size":346512,"stargazers_count":6,"watchers_count":6,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":7,"forks":5,"open_issues":7,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/randoop/randoop/pulls/57"},"html":{"href":"https://github.com/randoop/randoop/pull/57"},"issue":{"href":"https://api.github.com/repos/randoop/randoop/issues/57"},"comments":{"href":"https://api.github.com/repos/randoop/randoop/issues/57/comments"},"review_comments":{"href":"https://api.github.com/repos/randoop/randoop/pulls/57/comments"},"review_comment":{"href":"https://api.github.com/repos/randoop/randoop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/randoop/randoop/pulls/57/commits"},"statuses":{"href":"https://api.github.com/repos/randoop/randoop/statuses/a94159a84712ae776e82ceb09174446c26636cca"}}}}