Skip to content

Commit 99c693e

Browse files
kweinmeistergcf-owl-bot[bot]
authored andcommitted
test: remove extra println causing NPE in test (#495)
* fix: remove extra println causing NPE in test * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * test: add delays to prevent quota issue * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * test: update import in DetectIntentIT * test: tests declare they throw InterruptedException Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 976c23b commit 99c693e

11 files changed

+44
-8
lines changed

dialogflow-cx/snippets/src/test/java/dialogflow/cx/CreateAgentIT.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,17 @@ public void setUp() throws IOException {
4343
}
4444

4545
@After
46-
public void tearDown() throws IOException {
46+
public void tearDown() throws IOException, InterruptedException {
4747
System.setOut(originalOut);
4848
String apiEndpoint = "global-dialogflow.googleapis.com:443";
4949

5050
AgentsSettings agentsSettings = AgentsSettings.newBuilder().setEndpoint(apiEndpoint).build();
5151
AgentsClient client = AgentsClient.create(agentsSettings);
5252

5353
client.deleteAgent(CreateAgentIT.agentPath);
54+
55+
// Small delay to prevent reaching quota limit of requests per minute
56+
Thread.sleep(250);
5457
}
5558

5659
@Test

dialogflow-cx/snippets/src/test/java/dialogflow/cx/CreateFlowIT.java

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ public static void tearDown() throws Exception {
6868
try (FlowsClient flowsClient = FlowsClient.create(flowsSettings)) {
6969
flowsClient.deleteFlow(newFlowNameRegional);
7070
}
71+
72+
// Small delay to prevent reaching quota limit of requests per minute
73+
Thread.sleep(250);
7174
}
7275
}
7376

dialogflow-cx/snippets/src/test/java/dialogflow/cx/CreateIntentIT.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public static void tearDown() throws Exception {
7070
intentsClient.deleteIntent(newIntentNameRegional);
7171
}
7272
}
73+
74+
// Small delay to prevent reaching quota limit of requests per minute
75+
Thread.sleep(250);
7376
}
7477

7578
@Test
@@ -93,7 +96,6 @@ public void testCreateIntentRegional() throws Exception {
9396
CreateIntent.createIntent(
9497
DISPLAY_NAME, PROJECT_ID, LOCATION_REGIONAL, AGENT_ID_REGIONAL, TRAINING_PHRASES_PARTS);
9598
newIntentNameRegional = result.getName();
96-
System.out.println("intent name new:" + newIntentNameRegional);
9799

98100
assertEquals(result.getTrainingPhrasesCount(), TRAINING_PHRASES_PARTS.size());
99101
for (TrainingPhrase trainingPhrase : result.getTrainingPhrasesList()) {

dialogflow-cx/snippets/src/test/java/dialogflow/cx/CreatePageIT.java

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ public static void tearDown() throws Exception {
5757
try (PagesClient pagesClient = PagesClient.create()) {
5858
pagesClient.deletePage(newPageNameGlobal);
5959
}
60+
61+
// Small delay to prevent reaching quota limit of requests per minute
62+
Thread.sleep(250);
6063
}
6164

6265
// Delete the newly created Page in the regional location.

dialogflow-cx/snippets/src/test/java/dialogflow/cx/DetectIntentIT.java

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.List;
2424
import java.util.Map;
2525
import java.util.UUID;
26+
import org.junit.After;
2627
import org.junit.Test;
2728
import org.junit.runner.RunWith;
2829
import org.junit.runners.JUnit4;
@@ -45,6 +46,12 @@ public class DetectIntentIT {
4546
private static String LANGUAGE_CODE = "en-US";
4647
private static List<String> TEXTS = Arrays.asList("hello", "book a meeting room");
4748

49+
@After
50+
public void tearDown() throws InterruptedException {
51+
// Small delay to prevent reaching quota limit of requests per minute
52+
Thread.sleep(250);
53+
}
54+
4855
@Test
4956
public void testDetectIntentGlobal() throws Exception {
5057
Map<String, QueryResult> queryResults =

dialogflow-cx/snippets/src/test/java/dialogflow/cx/DetectIntentStreamIT.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ public void setUp() {
5555
}
5656

5757
@After
58-
public void tearDown() {
58+
public void tearDown() throws InterruptedException {
5959
System.setOut(original);
6060
bout.reset();
61+
62+
// Small delay to prevent reaching quota limit of requests per minute
63+
Thread.sleep(250);
6164
}
6265

6366
@Test

dialogflow-cx/snippets/src/test/java/dialogflow/cx/ExportAgentIT.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void setUp() throws IOException {
7171
}
7272

7373
@After
74-
public void tearDown() throws IOException {
74+
public void tearDown() throws IOException, InterruptedException {
7575
stdOut = null;
7676
System.setOut(null);
7777
String apiEndpoint = "global-dialogflow.googleapis.com:443";
@@ -81,6 +81,9 @@ public void tearDown() throws IOException {
8181

8282
client.deleteAgent(ExportAgentIT.agentPath);
8383
client.close();
84+
85+
// Small delay to prevent reaching quota limit of requests per minute
86+
Thread.sleep(250);
8487
}
8588

8689
@Test

dialogflow-cx/snippets/src/test/java/dialogflow/cx/ListTestCaseResultsIT.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ public void setUp() throws IOException {
4343
}
4444

4545
@After
46-
public void tearDown() throws IOException {
46+
public void tearDown() throws IOException, InterruptedException {
4747
System.setOut(originalOut);
48+
49+
// Small delay to prevent reaching quota limit of requests per minute
50+
Thread.sleep(250);
4851
}
4952

5053
@Test

dialogflow-cx/snippets/src/test/java/dialogflow/cx/ListTrainingPhrasesTest.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ public void setUp() throws IOException {
4040
}
4141

4242
@After
43-
public void tearDown() throws IOException {
43+
public void tearDown() throws IOException, InterruptedException {
4444
stdOut = null;
4545
System.setOut(null);
46+
47+
// Small delay to prevent reaching quota limit of requests per minute
48+
Thread.sleep(250);
4649
}
4750

4851
@Test

dialogflow-cx/snippets/src/test/java/dialogflow/cx/PageManagementIT.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,17 @@ public static void setUp() throws IOException {
6565
}
6666

6767
@AfterClass
68-
public static void tearDown() throws IOException {
68+
public static void tearDown() throws IOException, InterruptedException {
6969
String apiEndpoint = "global-dialogflow.googleapis.com:443";
7070
String parentPath = "projects/" + PROJECT_ID + "/locations/global";
7171

7272
AgentsSettings agentsSettings = AgentsSettings.newBuilder().setEndpoint(apiEndpoint).build();
7373
AgentsClient client = AgentsClient.create(agentsSettings);
7474

7575
client.deleteAgent(parent);
76+
77+
// Small delay to prevent reaching quota limit of requests per minute
78+
Thread.sleep(250);
7679
}
7780

7881
@Test

dialogflow-cx/snippets/src/test/java/dialogflow/cx/UpdateIntentTest.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void setUp() throws IOException {
7474
}
7575

7676
@After
77-
public void tearDown() throws IOException {
77+
public void tearDown() throws IOException, InterruptedException {
7878
stdOut = null;
7979
System.setOut(null);
8080
String apiEndpoint = "global-dialogflow.googleapis.com:443";
@@ -84,6 +84,9 @@ public void tearDown() throws IOException {
8484
AgentsClient client = AgentsClient.create(agentsSettings);
8585

8686
client.deleteAgent(parent);
87+
88+
// Small delay to prevent reaching quota limit of requests per minute
89+
Thread.sleep(250);
8790
}
8891

8992
@Test

0 commit comments

Comments
 (0)