File tree 4 files changed +5
-14
lines changed
main/java/com/example/language
test/java/com/example/language
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 {
30
30
31
31
// The text to analyze
32
32
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 ();
35
34
36
35
// Detects the sentiment of the text
37
36
Sentiment sentiment = language .analyzeSentiment (doc ).getDocumentSentiment ();
Original file line number Diff line number Diff line change 20
20
import com .google .cloud .language .v1 .LanguageServiceClient ;
21
21
import com .google .cloud .language .v1 .LanguageServiceSettings ;
22
22
import com .google .cloud .language .v1 .Sentiment ;
23
-
24
23
import java .io .IOException ;
25
24
26
25
class SetEndpoint {
27
26
28
27
// Change your endpoint
29
28
static void setEndpoint () throws IOException {
30
29
// [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 ();
34
32
35
33
// Initialize client that will be used to send requests. This client only needs to be created
36
34
// once, and can be reused for multiple requests. After completing all of your requests, call
@@ -40,8 +38,7 @@ static void setEndpoint() throws IOException {
40
38
41
39
// The text to analyze
42
40
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 ();
45
42
46
43
// Detects the sentiment of the text
47
44
Sentiment sentiment = client .analyzeSentiment (doc ).getDocumentSentiment ();
Original file line number Diff line number Diff line change 26
26
import org .junit .runner .RunWith ;
27
27
import org .junit .runners .JUnit4 ;
28
28
29
- /**
30
- * Tests for quickstart sample.
31
- */
29
+ /** Tests for quickstart sample. */
32
30
@ RunWith (JUnit4 .class )
33
31
@ SuppressWarnings ("checkstyle:abbreviationaswordinname" )
34
32
public class QuickstartSampleIT {
Original file line number Diff line number Diff line change 21
21
import java .io .ByteArrayOutputStream ;
22
22
import java .io .IOException ;
23
23
import java .io .PrintStream ;
24
-
25
24
import org .junit .After ;
26
25
import org .junit .Before ;
27
26
import org .junit .Test ;
@@ -36,7 +35,6 @@ public class SetEndpointIT {
36
35
private ByteArrayOutputStream bout ;
37
36
private PrintStream out ;
38
37
39
-
40
38
@ Before
41
39
public void setUp () {
42
40
bout = new ByteArrayOutputStream ();
@@ -49,7 +47,6 @@ public void tearDown() {
49
47
System .setOut (null );
50
48
}
51
49
52
-
53
50
@ Test
54
51
public void testSetEndpoint () throws IOException {
55
52
// Act
You can’t perform that action at this time.
0 commit comments