diff --git a/translate/snippets/src/main/java/com/example/translate/QuickstartSample.java b/translate/snippets/src/main/java/com/example/translate/QuickstartSample.java index 75523d0dcaf..8339650d077 100644 --- a/translate/snippets/src/main/java/com/example/translate/QuickstartSample.java +++ b/translate/snippets/src/main/java/com/example/translate/QuickstartSample.java @@ -26,11 +26,7 @@ public class QuickstartSample { public static void main(String... args) throws Exception { // Instantiates a client - Translate translate = - TranslateOptions.builder() - .apiKey(args[0]) // .apiKey("YOUR_API_KEY") - .build() - .service(); + Translate translate = TranslateOptions.getDefaultInstance().getService(); // The text to translate String text = "Hello, world!"; diff --git a/translate/snippets/src/test/java/com/example/translate/QuickstartSampleIT.java b/translate/snippets/src/test/java/com/example/translate/QuickstartSampleIT.java index c91651b2a74..e27b59cba97 100644 --- a/translate/snippets/src/test/java/com/example/translate/QuickstartSampleIT.java +++ b/translate/snippets/src/test/java/com/example/translate/QuickstartSampleIT.java @@ -50,11 +50,8 @@ public void tearDown() { @Test public void testQuickstart() throws Exception { - // Arrange - String apiKey = System.getenv("GOOGLE_API_KEY"); - // Act - QuickstartSample.main(apiKey); + QuickstartSample.main(); // Assert String got = bout.toString();