Skip to content

Commit

Permalink
fix: missed some tests during refactor #1033
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald Holshausen committed May 18, 2020
1 parent 314f4c8 commit b7e882e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public Description getDescription() {
@Override
public void run(final RunNotifier notifier) {
RunNotifier testNotifier = new RunNotifier();
final OrderedMap<Description, Boolean> failed = ListOrderedMap.listOrderedMap(new HashMap<>());
testNotifier.addListener(new RunListener() {
@Override
public void testRunStarted(Description description) throws Exception {
Expand All @@ -41,21 +40,22 @@ public void testRunFinished(Result result) throws Exception {

@Override
public void testStarted(Description description) throws Exception {
failed.put(description, false);
notifier.fireTestStarted(description);
}

@Override
public void testFailure(Failure failure) throws Exception {
failed.put(failed.lastKey(), true);
notifier.fireTestFinished(failure.getDescription());
}

@Override
public void testIgnored(Description description) throws Exception {
notifier.fireTestFailure(new Failure(description, new Exception("Expected the test to fail but it did not")));
}

@Override
public void testFinished(Description description) throws Exception {
if (!failed.get(description)) {
notifier.fireTestFailure(new Failure(description, new Exception("Expected the test to fail but it did not")));
}
notifier.fireTestFinished(description);
notifier.fireTestFailure(new Failure(description, new Exception("Expected the test to fail but it did not")));
}
});
baseRunner.run(testNotifier);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package au.com.dius.pact.provider.junit;

import au.com.dius.pact.provider.junit.target.HttpTarget;
import au.com.dius.pact.provider.junitsupport.Provider;
import au.com.dius.pact.provider.junitsupport.loader.PactFolder;
import au.com.dius.pact.provider.junit.target.HttpTarget;
import au.com.dius.pact.provider.junitsupport.target.Target;
import au.com.dius.pact.provider.junitsupport.target.TestTarget;
import com.github.restdriver.clientdriver.ClientDriverRule;
Expand Down Expand Up @@ -32,7 +32,7 @@ public class ProviderStateTest {
public void before() {
embeddedService.noFailFastOnUnexpectedRequest();
embeddedService.addExpectation(
onRequestTo("/data"), giveEmptyResponse()
onRequestTo("/data").withAnyParams(), giveEmptyResponse()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class PactVerificationContextSpec extends Specification {
context.testExecutionResult[0].results.size() == 1
context.testExecutionResult[0].results[0].message == 'Request to provider failed with an exception'
context.testExecutionResult[0].results[0].exception.cause instanceof IOException
context.testExecutionResult[0].results[0].interactionId == '12345'
context.testExecutionResult[0].interactionId == '12345'
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ class ProviderVerifierSpec extends Specification {
result.results.size() == 1
result.results[0].message == 'State change request failed'
result.results[0].exception instanceof IOException
result.results[0].interactionId == '1234'
result.interactionId == '1234'
}

def 'verifyInteraction returns an error result if any matcher paths are invalid'() {
Expand Down Expand Up @@ -662,7 +662,7 @@ class ProviderVerifierSpec extends Specification {
result.results.size() == 1
result.results[0].message == 'Request to provider failed with an exception'
result.results[0].exception instanceof IOException
result.results[0].interactionId == '12345678'
result.interactionId == '12345678'
}

def 'verifyResponseByInvokingProviderMethods returns an error result if the method fails with an exception'() {
Expand All @@ -683,6 +683,6 @@ class ProviderVerifierSpec extends Specification {
result.results.size() == 1
result.results[0].message == 'Request to provider method failed with an exception'
result.results[0].exception instanceof Exception
result.results[0].interactionId == 'abc123'
result.interactionId == 'abc123'
}
}

0 comments on commit b7e882e

Please sign in to comment.