Skip to content

Commit

Permalink
Setting containers as vals vs vars (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
schrepfler authored and dimafeng committed Jun 18, 2019
1 parent 2a2ee80 commit ef3e2d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ class CassandraContainer(dockerImageNameOverride: Option[String] = None,

type OTCContainer = OTCGenericContainer[T] forSome {type T <: OTCCassandraContainer[T]}

var cassandraContainer: OTCCassandraContainer[Nothing] = null

if (dockerImageNameOverride.isEmpty) {
cassandraContainer = new OTCCassandraContainer()
} else {
cassandraContainer = new OTCCassandraContainer(dockerImageNameOverride.get)
val cassandraContainer: OTCCassandraContainer[Nothing] = {
if (dockerImageNameOverride.isEmpty) {
new OTCCassandraContainer()
} else {
new OTCCassandraContainer(dockerImageNameOverride.get)
}
}

if (configurationOverride.isDefined) cassandraContainer.withConfigurationOverride(configurationOverride.get)
Expand All @@ -37,4 +37,4 @@ object CassandraContainer {
jmxReporting
)

}
}
14 changes: 7 additions & 7 deletions src/main/scala/com/dimafeng/testcontainers/KafkaContainer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ class KafkaContainer(confluentPlatformVersion: Option[String] = None,

type OTCContainer = OTCGenericContainer[T] forSome {type T <: OTCKafkaContainer}

var kafkaContainer: OTCKafkaContainer = null

if (confluentPlatformVersion.isEmpty) {
kafkaContainer = new OTCKafkaContainer()
} else {
kafkaContainer = new OTCKafkaContainer(confluentPlatformVersion.get)
val kafkaContainer: OTCKafkaContainer = {
if (confluentPlatformVersion.isEmpty) {
new OTCKafkaContainer()
} else {
new OTCKafkaContainer(confluentPlatformVersion.get)
}
}

if (externalZookeeper.isEmpty) {
Expand All @@ -30,4 +30,4 @@ object KafkaContainer {
externalZookeeper: String = null): KafkaContainer = {
new KafkaContainer(Option(confluentPlatformVersion), Option(externalZookeeper))
}
}
}

0 comments on commit ef3e2d7

Please sign in to comment.