PolymerLabs / arcs

Arcs
BSD 3-Clause "New" or "Revised" License
56 stars 35 forks source link

Defines a custom Truth Subject for RawEntity. #7033

Closed copybara-service[bot] closed 3 years ago

copybara-service[bot] commented 3 years ago

Defines a custom Truth Subject for RawEntity.

It will display a much nicer diff when two RawEntities are different.

Instead of displaying something incomprehensible like this:

expected value: RawEntity(id=nYv2CsqyUhizSgATk1iWDdcH2lyH, singletons={textField=Primitive(JfMTAZxJfMTAZx), numField=Primitive(0.9139672143466999), boolField=Primitive(true), byteField=Primitive(118), shortField=Primitive(13838), intField=Primitive(-550336807), longField=Primitive(2404219702989143466), charField=Primitive(X), floatField=Primitive(0.76486343), doubleField=Primitive(0.9566789532716665), instantField=Primitive(51598822455702662), durationField=Primitive(-4422967655465562966), bigintField=Primitive(-5994803041829044736), ... but was : RawEntity(id=nYv2CsqyUhizSgATk1iWDdcH2lyH, singletons={longField=Primitive(2404219702989143466), floatField=Primitive(0.76486343), numListField=List([Primitive(0.7339245428056974), Primitive(0.672748944749758)]), instantField=Primitive(51598822455702662), inlineListField=List([RawEntity(id=PbHWmtJ5fzjBiSLcvLx3hVmo2rJEKGckEwUl, singletons={longField=Primitive(-1888722560329383402), moreReferenceField=RawReference(id=Nx2b42EL59jIINYKTlTCm1HXrAtw5D7YQZiOzJQRWQ7, storageKey=dummy://NpUkJfMTAZxhdyDOLss085RG4kMrQwb4z4OAtr, version=null, _creationTimestamp=-1, _expirationTimestamp=-1, isHardReference=false), numberField=Primitive(0.060857055216978706), ...

It now says this:

RawEntity instances are different for field: rawEntity.collections[numsField][1] expected : Primitive(0.695700200506916) but was : Primitive(0.46839655204527963)