bastion-dev / Bastion

Java test library for HTTP APIs
http://bastion.rocks
GNU General Public License v3.0
13 stars 8 forks source link

Abstract common functionality in assertion objects to eliminate duplication #66

Open mariacamenzuli opened 7 years ago

mariacamenzuli commented 7 years ago

Assertion objects have some common capabilities. For example, both the JsonSchemaAssertions and the JsonResponseAssertions allow the user to set an expected content type. The code that handles this kind of common functionality is currently duplicated in these requests. There may be other cases of this. At the end of the day, these objects are all making assertions on HTTP responses, so they are bound to have some common functionality.

We need to refactor the assertions to abstract this common functionality.

Suggestion from @KPull: We can abstract this into a CommonAssertions object (just like we have CommonRequestAttributes), and have the applicable assertions inherit from CommonAssertions by composition.