Skip to content

Commit

Permalink
cleanup the verification text so it is more like the ruby version
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald Holshausen committed Aug 7, 2014
1 parent 114ac86 commit c06fde1
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,21 @@ class PactVerificationTask extends DefaultTask {
.boldOff().a(' and ').bold().a(providerToVerify.name).boldOff())
def interactions = JavaConverters$.MODULE$.asJavaIteratorConverter(pact.interactions().iterator())
interactions.asJava().each { Interaction interaction ->
def interactionMessage = "Verifying a pact between ${consumer.name} and ${providerToVerify.name} - ${interaction.description()}"

def stateChangeOk = true
if (interaction.providerState.defined) {
stateChangeOk = stateChange(interaction.providerState.get(), consumer)
if (stateChangeOk != true) {
ext.failures["Verifying a pact between ${consumer.name} and ${providerToVerify.name}"] = stateChangeOk
ext.failures[interactionMessage] = stateChangeOk
stateChangeOk = false
} else {
interactionMessage += " Given " + interaction.providerState.get()
}
}

if (stateChangeOk) {
AnsiConsole.out().println(Ansi.ansi().a(' ').a(interaction.description()))
def interactionMessage = "Verifying a pact between ${consumer.name} and ${providerToVerify.name} - ${interaction.description()}"

try {
ProviderClient client = new ProviderClient(request: interaction.request(), provider: providerToVerify)
Expand Down Expand Up @@ -117,12 +120,12 @@ class PactVerificationTask extends DefaultTask {
}

void displayBodyResult(Map failures, String body, def comparison, String comparisonDescription) {
def ansi = Ansi.ansi().a(' ').a('has body').a(' (')
def ansi = Ansi.ansi().a(' ').a('has a matching body').a(' (')
if (comparison == true) {
AnsiConsole.out().println(ansi.fg(Ansi.Color.GREEN).a('OK').reset().a(')'))
} else {
AnsiConsole.out().println(ansi.fg(Ansi.Color.RED).a('FAILED').reset().a(')'))
failures["$comparisonDescription has body"] = comparison
failures["$comparisonDescription has a matching body"] = comparison
}
}

Expand Down

0 comments on commit c06fde1

Please sign in to comment.