Skip to content

flyinfish/pactexamples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

A playground for a JAX-RS Client and Pact examples.

Starting the demo server

This server runs using Node.

  • npm install
  • npm start

Now the server will be running on port 8091.

To see what the server does, see app.js.

Pacts

This project contains a number of consumer tests:

  • EventsConsumer1 - tests an array of objects, using no annotations or abstract classes from Pact
  • EventsConsumer2 - ditto, using annotations
  • EventsConsumer3 - ditto, using abstract class from Pact

These three tests create JSONs under target/pacts. These should be copied into src/test/resources/pacts. They are used by ProviderTest to check the server is adhering to the contract.

TODO

  • create tests for "dictionaries", ie objects with dynamic fieldnames.

Notes

  • Added JacksonConfig to META-INF/services/javax.ws.rs.ext.Providers so that Java 8 dates are nicely serialised.
  • Added log4j.category.au.com.dius.pact.consumer.UnfilteredMockProvider=DEBUG to log4j.properties

Ideas for tutorial

  • Add .body("{}") into a GET request and use logging to get trainees to work out what is wrong.
  • Change app.js and see what you have to change to make provider test fail
  • Check Baards notes
  • State
  • See report under target/pact/reports
    • .uponReceiving("...") should be unique so that report doesn't get overwritten
  • Naming conventions for tests?
  • which of the three types of test should we use?

Support

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 93.0%
  • JavaScript 7.0%