Skip to content

Commit 71ef3d6

Browse files
averikitschlesv
authored andcommitted
samples: update shared config (#2443)
* update shared config * Update to 1.0.13 * lint * Fix linting * lint * fix imports Co-authored-by: Les Vogel <[email protected]>
1 parent 998be08 commit 71ef3d6

File tree

4 files changed

+5
-14
lines changed

4 files changed

+5
-14
lines changed

language/snippets/src/main/java/com/example/language/QuickstartSample.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ public static void main(String... args) throws Exception {
3030

3131
// The text to analyze
3232
String text = "Hello, world!";
33-
Document doc = Document.newBuilder()
34-
.setContent(text).setType(Type.PLAIN_TEXT).build();
33+
Document doc = Document.newBuilder().setContent(text).setType(Type.PLAIN_TEXT).build();
3534

3635
// Detects the sentiment of the text
3736
Sentiment sentiment = language.analyzeSentiment(doc).getDocumentSentiment();

language/snippets/src/main/java/com/example/language/SetEndpoint.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@
2020
import com.google.cloud.language.v1.LanguageServiceClient;
2121
import com.google.cloud.language.v1.LanguageServiceSettings;
2222
import com.google.cloud.language.v1.Sentiment;
23-
2423
import java.io.IOException;
2524

2625
class SetEndpoint {
2726

2827
// Change your endpoint
2928
static void setEndpoint() throws IOException {
3029
// [START language_set_endpoint]
31-
LanguageServiceSettings settings = LanguageServiceSettings.newBuilder()
32-
.setEndpoint("eu-language.googleapis.com:443")
33-
.build();
30+
LanguageServiceSettings settings =
31+
LanguageServiceSettings.newBuilder().setEndpoint("eu-language.googleapis.com:443").build();
3432

3533
// Initialize client that will be used to send requests. This client only needs to be created
3634
// once, and can be reused for multiple requests. After completing all of your requests, call
@@ -40,8 +38,7 @@ static void setEndpoint() throws IOException {
4038

4139
// The text to analyze
4240
String text = "Hello, world!";
43-
Document doc = Document.newBuilder()
44-
.setContent(text).setType(Document.Type.PLAIN_TEXT).build();
41+
Document doc = Document.newBuilder().setContent(text).setType(Document.Type.PLAIN_TEXT).build();
4542

4643
// Detects the sentiment of the text
4744
Sentiment sentiment = client.analyzeSentiment(doc).getDocumentSentiment();

language/snippets/src/test/java/com/example/language/QuickstartSampleIT.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
import org.junit.runner.RunWith;
2727
import org.junit.runners.JUnit4;
2828

29-
/**
30-
* Tests for quickstart sample.
31-
*/
29+
/** Tests for quickstart sample. */
3230
@RunWith(JUnit4.class)
3331
@SuppressWarnings("checkstyle:abbreviationaswordinname")
3432
public class QuickstartSampleIT {

language/snippets/src/test/java/com/example/language/SetEndpointIT.java

-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.io.ByteArrayOutputStream;
2222
import java.io.IOException;
2323
import java.io.PrintStream;
24-
2524
import org.junit.After;
2625
import org.junit.Before;
2726
import org.junit.Test;
@@ -36,7 +35,6 @@ public class SetEndpointIT {
3635
private ByteArrayOutputStream bout;
3736
private PrintStream out;
3837

39-
4038
@Before
4139
public void setUp() {
4240
bout = new ByteArrayOutputStream();
@@ -49,7 +47,6 @@ public void tearDown() {
4947
System.setOut(null);
5048
}
5149

52-
5350
@Test
5451
public void testSetEndpoint() throws IOException {
5552
// Act

0 commit comments

Comments
 (0)