Closed DaniRey closed 4 years ago
The long method names are not great. An alternative might be
testee completelyFits types of gauge
instead of
testeee fits typesAndHasOnlyPropertiesSpecified by gauge
All variants would then be
testee completelyFits types of gauge
testee completelyFits typesAndArraySizes of gauge
testee completelyFits values of gauge
testee completelyFits valuesIgnoringArrayOrder of gauge
@exoego do you have an opinion on this change?
I am fine with these longer names 😀
@exoego sorry for the late reply. Does that mean you would favor
testeee fits typesAndHasOnlyPropertiesSpecified by gauge
over
testee completelyFits types of gauge
I personally prefer the shorter variant using completelyFits
. But I would like to gather as much input as I can, before commiting this to the next release.
I personally prefer:
I think fits typesAndHasOnlyPropertiesSpecified
is a bit long and verbose, but maybe better choice, since it explains a lot than completelyFits types
.
(For first look, It is unclear what complete
is intended for)
I think DSL like testee completelyFits types of gauge
makes sense if there are other variants of assertion, something like:
testee completelyFits types of HERE
testee completelyFits HERE of gauge
testee VERB types of gauge
Thank you for that valuable input. I usually prefer self-explaining names as well. Unfortunately I couldn't find a name that makes the DSL feel nice and consistent, while being self-explaining.
There are indeed other variants of assertions. I will therefore use completelyFits
.
With ScalaWebTest 3.0.x we have the following assertions for JSON.
testee fits types of gauge
testee fits typesAndArraySizes of gauge
testee fits values of gauge
testee fits valuesIgnoringArrayOrder of gauge
As of ScalaWebTest 4.0.x, we will have the following assertions for JSON.
testee fits types of gauge
testee completelyFits types of gauge
testee fits typesAndArraySizes of gauge
testee completelyFits typesAndArraySizes of gauge
testee fits values of gauge
testee completelyFits values of gauge
testee fits valuesIgnoringArrayOrder of gauge
testee completelyFits valuesIgnoringArrayOrder of gauge
The methods fits
and completelyFits
are documented as follows.
/**
* Build a JsonGauge, which checks if the testee fits the gaugeDefinition, by the rules of the gaugeType.
* The testee might contain properties, which are not specified in the gaugeDefinition.
*/
def fits(gaugeType: GaugeType): JsonGaugeFits = JsonGaugeFits(gaugeByType(gaugeType))
/**
* Build a JsonGauge, which checks if the testee fits the gaugeDefinition, by the rules of the gaugeType.
* More restrictive then @see [[org.scalawebtest.json.JsonGauge.JsonGaugeFromPlayJson#fits]]. All properties
* of the testee have to be specified by the gaugeDefinition.
*/
def completelyFits(gaugeType: GaugeType): JsonGaugeFits = JsonGaugeFits(gaugeByType(gaugeType, allPropertiesDefined = true))
Thanks !
Now I understood how completelyFits
works.
It sounds better choice than typesAndHasOnlyPropertiesSpecified
by
as a synonym forof
after the gaugeType when building a json gauge