File tree Expand file tree Collapse file tree 4 files changed +5
-14
lines changed
main/java/com/example/language
test/java/com/example/language Expand file tree Collapse file tree 4 files changed +5
-14
lines changed Original file line number Diff line number Diff 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 ();
Original file line number Diff line number Diff line change 2020import com .google .cloud .language .v1 .LanguageServiceClient ;
2121import com .google .cloud .language .v1 .LanguageServiceSettings ;
2222import com .google .cloud .language .v1 .Sentiment ;
23-
2423import java .io .IOException ;
2524
2625class 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 ();
Original file line number Diff line number Diff line change 2626import org .junit .runner .RunWith ;
2727import 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" )
3432public class QuickstartSampleIT {
Original file line number Diff line number Diff line change 2121import java .io .ByteArrayOutputStream ;
2222import java .io .IOException ;
2323import java .io .PrintStream ;
24-
2524import org .junit .After ;
2625import org .junit .Before ;
2726import 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
You can’t perform that action at this time.
0 commit comments