Skip to content

Commit

Permalink
fixed code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
markozz committed Aug 26, 2020
1 parent 34cbb0c commit b6e81b7
Showing 1 changed file with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package au.com.dius.pact.server

import au.com.dius.pact.server.Config
import au.com.dius.pact.server.Publish
import spock.lang.Specification

class PublishSpec extends Specification {
Expand All @@ -15,25 +13,37 @@ class PublishSpec extends Specification {
def result = Publish.getBrokerUrlFromConfig(config)

then:
!result.isDefined()
!result.defined
}

def 'valid broker url will set broker'() {
given:
def config = new Config(80, '0.0.0.0', false, 100, 200, false, 3, '', '', 0, 'https://valid.broker.com', 'abc#3')
def config = new Config(80,
'0.0.0.0',
false,
100,
200,
false,
3,
'',
'',
0,
'https://valid.broker.com',
'abc#3'
)

when:
def result = Publish.getBrokerUrlFromConfig(config)

then:
result.isDefined()
result.defined
}

def 'successful read on valid file'() {
given:
def content = """ {"consumer": "testconsumer", "provider": "testprovider"} """
def fileName = "test.json"
def rootDir = System.getProperty("pact.rootDir", "target/pacts")
def content = '{"consumer": "testconsumer", "provider": "testprovider"}'
def fileName = 'test.json'
def rootDir = System.getProperty('pact.rootDir', 'target/pacts')
def file = new File("${rootDir}/$fileName")
new File(rootDir).mkdirs()
file.write(content)
Expand All @@ -45,12 +55,12 @@ class PublishSpec extends Specification {
content == result

cleanup:
new File(System.getProperty("pact.rootDir", "target")).deleteDir()
new File(System.getProperty('pact.rootDir', 'target')).deleteDir()
}

def 'unsuccessful read on invalid file'() {
when:
Publish.readContract("invalid")
Publish.readContract('invalid')

then:
thrown(IOException)
Expand Down

0 comments on commit b6e81b7

Please sign in to comment.