By default, Scala 2.11 is used. To build it for another Scala version, switch to the required Scala version first.
# E.g. to switch to Scala 2.13 use
mvn scala-cross-build:change-version -Pscala-2.13
When building the project activate a Scala profile corresponding to the Scala version of the codebase.
# E.g. for Scala 2.13 use
mvn clean install -Pscala-2.13
./build-all.sh
./mvn clean verify -Pcode-coverage
Code coverage will be generated on path:
{project-root}\target\site\jacoco
```scala
it should "test that new Spark feature" taggedAs ignoreIf(ver"$SPARK_VERSION" < ver"2.4") in {
...
}
it should "test some DAO" taggedAs ignoreIf(!isDatabaseAvailable) in {
...
}
```
```scala
captureStdOut(Console.out.print("foo")) should be("foo")
```
```scala
captureExitStatus(System.exit(42)) should be(42)
// OR
assertingExitStatus(be > 0 and be < 5) {
// run some code that calls System.exit(...)
}
```
```scala
class MySpec ... with EnvFixture {
it should "set FOO variable for this test body only" in {
setEnv("FOO", 42)
// execute some test code that reads FOO environment variable
// via the standard Java API like System.getenv("FOO")
}
}
```
```scala
(
"""
{
a: 111,
b: {
v: 42
}
}
"""
should equal ("{ a: 111, b: { v: 42 } }")
(after being trimmed and whitespaceNormalized)
)
```
```scala
class MySpec ... with CommonMatchers {
it should "produce the correct URI" in {
val uri: String = ???
uri should equalToUri("file:///foo.txt")
// compares using java.net.URI`s equals method
}
}
```
Copyright 2019 ABSA Group Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.