echauchot commented on a change in pull request #15973:
URL: https://github.com/apache/beam/pull/15973#discussion_r770733369
##########
File path:
sdks/java/io/amazon-web-services2/src/test/java/org/apache/beam/sdk/io/aws2/kinesis/AmazonKinesisMock.java
##########
@@ -326,8 +304,23 @@ public IncreaseStreamRetentionPeriodResponse
increaseStreamRetentionPeriod(
}
@Override
- public ListShardsResponse listShards(ListShardsRequest listShardsRequest) {
- throw new RuntimeException("Not implemented");
+ public ListShardsResponse listShards(ListShardsRequest listShardsRequest)
+ throws LimitExceededException {
+ if (expectedListShardsLimitExceededException) {
+ throw LimitExceededException.builder().message("ListShards rate limit
exceeded").build();
+ }
+
+ List<Shard> shards =
+ IntStream.range(0, shardedData.size())
+ .boxed()
+ .map(i -> Shard.builder().shardId(Integer.toString(i)).build())
+ .collect(Collectors.toList());
+
+ return (ListShardsResponse)
Review comment:
`ListShardsResponse` with builder and http response is indeed better
than the previous version
##########
File path:
sdks/java/io/amazon-web-services2/src/test/java/org/apache/beam/sdk/io/aws2/kinesis/DynamicCheckpointGeneratorTest.java
##########
@@ -20,22 +20,21 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
-import java.util.Set;
-import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Sets;
+import java.util.List;
+import
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.powermock.modules.junit4.PowerMockRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import software.amazon.awssdk.services.kinesis.model.Shard;
import software.amazon.kinesis.common.InitialPositionInStream;
/** * */
-@RunWith(PowerMockRunner.class)
+@RunWith(MockitoJUnitRunner.class)
Review comment:
yes mockito is our prefered mocking framework
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]