scala-aws-utils-testkit

Test utilities for interacting with the AWS SDKs from Scala

License

License

MIT
Categories

Categories

Scala Languages AWS Container PaaS Providers
GroupId

GroupId

com.dwolla
ArtifactId

ArtifactId

scala-aws-utils-testkit_2.12
Last Version

Last Version

1.6.2
Release Date

Release Date

Type

Type

jar
Description

Description

scala-aws-utils-testkit
Test utilities for interacting with the AWS SDKs from Scala
Project URL

Project URL

https://github.com/Dwolla/scala-aws-utils
Project Organization

Project Organization

com.dwolla
Source Code Management

Source Code Management

https://github.com/Dwolla/scala-aws-utils

Download scala-aws-utils-testkit_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/com.dwolla/scala-aws-utils-testkit_2.12/ -->
<dependency>
    <groupId>com.dwolla</groupId>
    <artifactId>scala-aws-utils-testkit_2.12</artifactId>
    <version>1.6.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.dwolla/scala-aws-utils-testkit_2.12/
implementation 'com.dwolla:scala-aws-utils-testkit_2.12:1.6.2'
// https://jarcasting.com/artifacts/com.dwolla/scala-aws-utils-testkit_2.12/
implementation ("com.dwolla:scala-aws-utils-testkit_2.12:1.6.2")
'com.dwolla:scala-aws-utils-testkit_2.12:jar:1.6.2'
<dependency org="com.dwolla" name="scala-aws-utils-testkit_2.12" rev="1.6.2">
  <artifact name="scala-aws-utils-testkit_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.dwolla', module='scala-aws-utils-testkit_2.12', version='1.6.2')
)
libraryDependencies += "com.dwolla" % "scala-aws-utils-testkit_2.12" % "1.6.2"
[com.dwolla/scala-aws-utils-testkit_2.12 "1.6.2"]

Dependencies

compile (5)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.13
com.amazonaws : aws-java-sdk-core jar 1.11.331
ch.qos.logback : logback-classic jar 1.2.3
org.scala-lang.modules : scala-collection-compat_2.12 jar 2.4.3
org.mockito : mockito-core jar 3.9.0

provided (2)

Group / Artifact Type Version
com.amazonaws : aws-java-sdk-cloudformation jar 1.11.331
com.amazonaws : aws-java-sdk-kms jar 1.11.331

test (3)

Group / Artifact Type Version
org.specs2 : specs2-core_2.12 jar 4.10.6
org.specs2 : specs2-mock_2.12 jar 4.10.6
com.amazonaws : aws-java-sdk-ecs jar 1.11.331

Project Modules

There are no modules declared in this project.

Scala AWS Utilities

Dwolla/scala-aws-utils CI license

Utilities package for working with the Java AWS SDKs from Scala and SBT.

Projects including this library will also need to explicitly include the AWS SDK libraries they will rely on, to avoid inadvertently importing more libraries than are required.

Artifacts

Library

"com.dwolla" %% "scala-aws-utils" % "1.4.0"

Test Kit

"com.dwolla" %% "scala-aws-utils-testkit" % "1.4.0" % Test

The test kit provides helpers to make mocking the Amazon Async Clients easier. The clients have interfaces like

java.util.concurrent.Future<DescribeInstancesResult> describeInstancesAsync(DescribeInstancesRequest describeInstancesRequest,
                                                                            AsyncHandler<DescribeInstancesRequest, DescribeInstancesResult> asyncHandler)

Because the method returns a Java Future, the “return value” for the function is actually returned by invoking a method on the passed AsyncHandler. This is inconvenient to set up.

Instead, the test kit provides a DSL for setting up the mocks. For example:

import com.dwolla.awssdk.AmazonAsyncMockingImplicits._

val mockClient = mock[AmazonEC2Async]

mockedMethod(mockClient.describeInstancesAsync) answers (
  new DescribeInstancesRequest().withInstanceIds("i-instance")  new DescribeInstancesResult(),
  new DescribeInstancesRequest()  new AmazonServiceException("access denied exception intentionally thrown by test")
)

The mocked method is provided with a mapping of AmazonWebServiceRequest instances of the correct type to the expected results. The results can either be actual result instances or exceptions to be thrown.

com.dwolla

Dwolla

Power your app with programmable our payments platform

Versions

Version
1.6.2