{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls/comments/81424309","pull_request_review_id":2408230,"id":81424309,"diff_hunk":"@@ -0,0 +1,121 @@\n+/*\n+ * Copyright 2016 Google Inc. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package com.google.cloud.translate.samples;\n+\n+import static com.google.common.truth.Truth.assertThat;\n+\n+import org.junit.Test;\n+import org.junit.runner.RunWith;\n+import org.junit.runners.JUnit4;\n+\n+import java.io.ByteArrayOutputStream;\n+import java.io.PrintStream;\n+import java.util.Arrays;\n+import java.util.List;\n+\n+/**\n+ * Unit tests for {@link Analyze}.\n+ */\n+@RunWith(JUnit4.class)\n+public class TranslateTextTest {\n+\n+  @Test public void testSupportedLanguages() throws Exception {\n+    // Supported languages\n+    List<String> languages = Arrays.asList(\n+        \"Afrikaans\", \"Albanian\", \"Amharic\", \"Arabic\", \"Armenian\", \"Azerbaijani\", \"Basque\",\n+        \"Belarusian\", \"Bengali\", \"Bosnian\", \"Bulgarian\", \"Catalan\", \"Cebuano\", \"Chichewa\",\n+        \"Chinese\", \"Chinese\", \"Corsican\", \"Croatian\", \"Czech\", \"Danish\", \"Dutch\", \"English\",\n+        \"Esperanto\", \"Estonian\", \"Filipino\", \"Finnish\", \"French\", \"Frisian\", \"Galician\",\n+        \"Georgian\", \"German\", \"Greek\", \"Gujarati\", \"Haitian\", \"Hausa\", \"Hawaiian\", \"Hebrew\",\n+        \"Hindi\", \"Hmong\", \"Hungarian\", \"Icelandic\", \"Igbo\", \"Indonesian\", \"Irish\", \"Italian\",\n+        \"Japanese\", \"Javanese\", \"Kannada\", \"Kazakh\", \"Khmer\", \"Korean\", \"Kurdish\", \"Kyrgyz\",\n+        \"Lao\", \"Latin\", \"Latvian\", \"Lithuanian\", \"Luxembourgish\", \"Macedonian\", \"Malagasy\",\n+        \"Malay\", \"Malayalam\", \"Maltese\", \"Maori\", \"Marathi\", \"Mongolian\", \"Myanmar\", \"Nepali\",\n+        \"Norwegian\", \"Pashto\", \"Persian\", \"Polish\", \"Portuguese\", \"Punjabi\", \"Romanian\",\n+        \"Russian\", \"Samoan\", \"Scots\", \"Serbian\", \"Sesotho\", \"Shona\", \"Sindhi\", \"Sinhala\",\n+        \"Slovak\", \"Slovenian\", \"Somali\", \"Spanish\", \"Sundanese\", \"Swahili\", \"Swedish\",\n+        \"Tajik\", \"Tamil\", \"Telugu\", \"Thai\", \"Turkish\", \"Ukrainian\", \"Urdu\", \"Uzbek\",\n+        \"Vietnamese\", \"Welsh\", \"Xhosa\", \"Yiddish\", \"Yoruba\", \"Zulu\");\n+\n+    // Arrange\n+    ByteArrayOutputStream bout = new ByteArrayOutputStream();\n+    PrintStream out = new PrintStream(bout);\n+\n+    // Act\n+    TranslateText.displaySupportedLanguages(out);\n+\n+    // Assert\n+    String got = bout.toString();\n+    for (String language : languages) {\n+      assertThat(got).contains(language);\n+    }\n+  }\n+\n+  @Test public void testEnglishLangDetection() throws Exception {\n+    // Arrange\n+    ByteArrayOutputStream bout = new ByteArrayOutputStream();\n+    PrintStream out = new PrintStream(bout);\n+\n+    // Act\n+    TranslateText.detectLanguage(\"With power comes great responsibility.\", out);\n+\n+    // Assert\n+    String got = bout.toString();\n+    assertThat(got).contains(\"language=en, confidence=0.79742646\");","path":"translate/src/test/java/com/google/cloud/translate/samples/TranslateTextTest.java","position":78,"original_position":78,"commit_id":"cdc4117d52c0969eef9546964795dd415ec4c32f","original_commit_id":"792cb56f6e94bab091e276a83ca1c8151f92a7af","user":{"login":"lesv","id":1136014,"avatar_url":"https://avatars.githubusercontent.com/u/1136014?v=3","gravatar_id":"","url":"https://api.github.com/users/lesv","html_url":"https://github.com/lesv","followers_url":"https://api.github.com/users/lesv/followers","following_url":"https://api.github.com/users/lesv/following{/other_user}","gists_url":"https://api.github.com/users/lesv/gists{/gist_id}","starred_url":"https://api.github.com/users/lesv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lesv/subscriptions","organizations_url":"https://api.github.com/users/lesv/orgs","repos_url":"https://api.github.com/users/lesv/repos","events_url":"https://api.github.com/users/lesv/events{/privacy}","received_events_url":"https://api.github.com/users/lesv/received_events","type":"User","site_admin":false},"body":"Wow, your comparing to a string?  That's not a great idea. (not my first choice of wording).\r\n\r\nConfidence will change with time, why not claim it will be within a range of .7 .. .9  This stuff tends to jump around as the model changes.","created_at":"2016-09-30T21:52:58Z","updated_at":"2016-09-30T21:52:58Z","html_url":"https://github.com/GoogleCloudPlatform/java-docs-samples/pull/348#discussion_r81424309","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls/348","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls/comments/81424309"},"html":{"href":"https://github.com/GoogleCloudPlatform/java-docs-samples/pull/348#discussion_r81424309"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls/348"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls/348","id":87404935,"html_url":"https://github.com/GoogleCloudPlatform/java-docs-samples/pull/348","diff_url":"https://github.com/GoogleCloudPlatform/java-docs-samples/pull/348.diff","patch_url":"https://github.com/GoogleCloudPlatform/java-docs-samples/pull/348.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/issues/348","number":348,"state":"open","locked":false,"title":"Translate sample","user":{"login":"puneith","id":8098778,"avatar_url":"https://avatars.githubusercontent.com/u/8098778?v=3","gravatar_id":"","url":"https://api.github.com/users/puneith","html_url":"https://github.com/puneith","followers_url":"https://api.github.com/users/puneith/followers","following_url":"https://api.github.com/users/puneith/following{/other_user}","gists_url":"https://api.github.com/users/puneith/gists{/gist_id}","starred_url":"https://api.github.com/users/puneith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puneith/subscriptions","organizations_url":"https://api.github.com/users/puneith/orgs","repos_url":"https://api.github.com/users/puneith/repos","events_url":"https://api.github.com/users/puneith/events{/privacy}","received_events_url":"https://api.github.com/users/puneith/received_events","type":"User","site_admin":false},"body":"@lesv @tswast Please review translate sample. ","created_at":"2016-09-29T22:22:02Z","updated_at":"2016-09-30T21:52:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d416c799c7ecc5147c4424a1b23224d7464c14b3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls/348/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls/348/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/issues/348/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/statuses/cdc4117d52c0969eef9546964795dd415ec4c32f","head":{"label":"GoogleCloudPlatform:translate_sample","ref":"translate_sample","sha":"cdc4117d52c0969eef9546964795dd415ec4c32f","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":32895424,"name":"java-docs-samples","full_name":"GoogleCloudPlatform/java-docs-samples","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/java-docs-samples","description":"","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/deployments","created_at":"2015-03-25T22:48:38Z","updated_at":"2016-09-27T15:03:31Z","pushed_at":"2016-09-30T20:40:30Z","git_url":"git://github.com/GoogleCloudPlatform/java-docs-samples.git","ssh_url":"git@github.com:GoogleCloudPlatform/java-docs-samples.git","clone_url":"https://github.com/GoogleCloudPlatform/java-docs-samples.git","svn_url":"https://github.com/GoogleCloudPlatform/java-docs-samples","homepage":null,"size":9909,"stargazers_count":119,"watchers_count":119,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":278,"mirror_url":null,"open_issues_count":20,"forks":278,"open_issues":20,"watchers":119,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"c4fafe13d1052be3825ecf72ff596e34ada02c9a","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":32895424,"name":"java-docs-samples","full_name":"GoogleCloudPlatform/java-docs-samples","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/java-docs-samples","description":"","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/deployments","created_at":"2015-03-25T22:48:38Z","updated_at":"2016-09-27T15:03:31Z","pushed_at":"2016-09-30T20:40:30Z","git_url":"git://github.com/GoogleCloudPlatform/java-docs-samples.git","ssh_url":"git@github.com:GoogleCloudPlatform/java-docs-samples.git","clone_url":"https://github.com/GoogleCloudPlatform/java-docs-samples.git","svn_url":"https://github.com/GoogleCloudPlatform/java-docs-samples","homepage":null,"size":9909,"stargazers_count":119,"watchers_count":119,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":278,"mirror_url":null,"open_issues_count":20,"forks":278,"open_issues":20,"watchers":119,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls/348"},"html":{"href":"https://github.com/GoogleCloudPlatform/java-docs-samples/pull/348"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/issues/348"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/issues/348/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls/348/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/pulls/348/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/java-docs-samples/statuses/cdc4117d52c0969eef9546964795dd415ec4c32f"}}}}
{"actor":{"display_login":"lesv"}}