Skip to content

Commit 58bc95a

Browse files
munkhuushmglShabirmean
authored andcommitted
chore: removed retry class and used com.google.cloud.testing.Multiple… (#398)
* chore: removed retry class and used com.google.cloud.testing.MultipleAttempt * xed lint
1 parent 18528ed commit 58bc95a

6 files changed

+21
-69
lines changed

translate/snippets/pom.xml

+7
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@
5959
<version>1.1.2</version>
6060
<scope>test</scope>
6161
</dependency>
62+
<dependency>
63+
<groupId>com.google.cloud</groupId>
64+
<artifactId>google-cloud-core</artifactId>
65+
<version>1.94.0</version>
66+
<scope>test</scope>
67+
<classifier>tests</classifier>
68+
</dependency>
6269
<!-- [END_EXCLUDE] -->
6370
</dependencies>
6471
<!-- [END translation_install_with_bom] -->

translate/snippets/src/test/java/com/example/translate/BatchTranslateTextTests.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.google.cloud.storage.Blob;
2424
import com.google.cloud.storage.Storage;
2525
import com.google.cloud.storage.StorageOptions;
26+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2627
import java.io.ByteArrayOutputStream;
2728
import java.io.IOException;
2829
import java.io.PrintStream;
@@ -49,7 +50,6 @@ public class BatchTranslateTextTests {
4950

5051
private ByteArrayOutputStream bout;
5152
private PrintStream out;
52-
@Rule public Retry retry = new Retry(3);
5353

5454
private static void cleanUpBucket() {
5555
Storage storage = StorageOptions.getDefaultInstance().getService();
@@ -106,6 +106,9 @@ public void tearDown() {
106106
System.setOut(originalPrintStream);
107107
}
108108

109+
@Rule
110+
public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);
111+
109112
@Test
110113
public void testBatchTranslateText()
111114
throws InterruptedException, ExecutionException, IOException, TimeoutException {

translate/snippets/src/test/java/com/example/translate/BatchTranslateTextWithGlossaryAndModelTests.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.google.cloud.storage.Blob;
2424
import com.google.cloud.storage.Storage;
2525
import com.google.cloud.storage.StorageOptions;
26+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2627
import java.io.ByteArrayOutputStream;
2728
import java.io.IOException;
2829
import java.io.PrintStream;
@@ -57,7 +58,6 @@ public class BatchTranslateTextWithGlossaryAndModelTests {
5758

5859
private ByteArrayOutputStream bout;
5960
private PrintStream out;
60-
@Rule public Retry retry = new Retry(3);
6161

6262
private static final void cleanUpBucket() {
6363
Storage storage = StorageOptions.getDefaultInstance().getService();
@@ -124,6 +124,9 @@ public void tearDown() throws InterruptedException, ExecutionException, IOExcept
124124
System.setOut(originalPrintStream);
125125
}
126126

127+
@Rule
128+
public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);
129+
127130
@Test
128131
public void testBatchTranslateTextWithGlossaryAndModel()
129132
throws InterruptedException, ExecutionException, IOException, TimeoutException {

translate/snippets/src/test/java/com/example/translate/BatchTranslateTextWithGlossaryTests.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.google.cloud.storage.Blob;
2424
import com.google.cloud.storage.Storage;
2525
import com.google.cloud.storage.StorageOptions;
26+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2627
import java.io.ByteArrayOutputStream;
2728
import java.io.IOException;
2829
import java.io.PrintStream;
@@ -122,7 +123,8 @@ public void tearDown() throws InterruptedException, ExecutionException, IOExcept
122123
System.setOut(originalPrintStream);
123124
}
124125

125-
@Rule public Retry retry = new Retry(3);
126+
@Rule
127+
public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);
126128

127129
@Test
128130
public void testBatchTranslateTextWithGlossary()

translate/snippets/src/test/java/com/example/translate/BatchTranslateTextWithModelTests.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.google.cloud.storage.Blob;
2424
import com.google.cloud.storage.Storage;
2525
import com.google.cloud.storage.StorageOptions;
26+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2627
import java.io.ByteArrayOutputStream;
2728
import java.io.IOException;
2829
import java.io.PrintStream;
@@ -106,7 +107,8 @@ public void tearDown() {
106107
System.setOut(originalPrintStream);
107108
}
108109

109-
@Rule public Retry retry = new Retry(3);
110+
@Rule
111+
public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);
110112

111113
@Test
112114
public void testBatchTranslateTextWithModel()

translate/snippets/src/test/java/com/example/translate/Retry.java

-65
This file was deleted.

0 commit comments

Comments
 (0)