Skip to content
Permalink
Browse files

Added logic for host - default to localhost if not provided.

  • Loading branch information...
linhpham committed Aug 9, 2015
1 parent ffaf1f6 commit c00184acf213d46d953add12fdceb44432e7dcf9
Showing with 14 additions and 8 deletions.
  1. +10 −2 src/main/groovy/Processor.groovy
  2. +4 −6 src/test/groovy/ProcessorSpec.groovy
@@ -5,13 +5,21 @@ import groovy.util.logging.*
@Log4j
class Processor {
def opts


def host

Processor(opts) {
log.level = Level.DEBUG
this.opts = opts
this.host = opts.h ?: 'localhost'
}

void run() {
log.info "Running..."
log.info "Host : $host"
log.info "User : ${opts.u}"
log.info "Password : ${opts.p}"
log.info "Source schema : ${opts.s}"
log.info "Destination schema : ${opts.d}"

}
}
@@ -1,11 +1,9 @@
import spock.lang.*

class ProcessSpec extends Specification {
def "#first test"() {
when:
def a = true

then:
a == false
def "#new set host to parameter, or default to localhost"() {
expect:
new Processor([]).host == 'localhost'
new Processor([h: 'myserver']).host == 'myserver'
}
}

0 comments on commit c00184a

Please sign in to comment.
You can’t perform that action at this time.