Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Is there any way to use MessageDifferencer from this repo by adding a maven dependency in my code? #579

Closed
sumitbh250 opened this issue Oct 22, 2019 · 8 comments

Comments

@sumitbh250
Copy link

No description provided.

@oferb
Copy link
Contributor

oferb commented Oct 22, 2019

Hey :)
Nope, it's not packaged.
It's taken from here though:
com.google.common.truth.extensions.proto.MessageDifferencer
So maybe you can get it from there:
https://mvnrepository.com/artifact/com.google.truth/truth

@sumitbh250
Copy link
Author

sumitbh250 commented Oct 22, 2019

@oferb Thanks for the quick response. I went through that repo too, but in that repo this class is made private https://jar-download.com/artifacts/com.google.truth.extensions/truth-proto-extension/0.39/source-code/com/google/common/truth/extensions/proto/MessageDifferencer.java. Any way I can use truth library to receive a boolean instead of assert for Message comparisons that you might be aware of?

@oferb
Copy link
Contributor

oferb commented Oct 22, 2019

Maybe you can send them a PR? :-)
It's just a small 1 word change :-))

Any way I can use truth library to receive a boolean instead of assert for Message comparisons that you might be aware of?
I'm not well-acquainted with that code, so I don't know.

But you can also just copy the class and use it.. or maybe in the meantime until they accept your PR :))

@sumitbh250
Copy link
Author

I tried copying the class locally but faced compilation issue of dependency
MessageDifferencer.java:[484,17] error: cannot find symbol [ERROR] symbol: class AutoValue_MessageDifferencer_SpecificField [ERROR] location: class SpecificField

I have added auto.value and auto.value.annotation to dependencies
<dependency> <groupId>com.google.auto.value</groupId> <artifactId>auto-value-annotations</artifactId> <version>1.7</version> </dependency> <dependency> <groupId>com.google.auto.value</groupId> <artifactId>auto-value</artifactId> <version>1.7</version> <scope>provided</scope> </dependency>

@sumitbh250
Copy link
Author

I'll mark this as resolved here. Thanks for the help :)

@ghost
Copy link

ghost commented Jan 28, 2020

Hi @sumitbh250 , did you manage to use this MessageDifferencer class?

@drather19
Copy link

@frankfighton fyi, if you'd like to use MessageDifferencer, you can do so so long as you include the following dependencies (gradle example given):

    compile "com.google.auto.value:auto-value-annotations:1.7"
    annotationProcessor "com.google.auto.value:auto-value:1.7"

@lan-n-tran
Copy link

lan-n-tran commented Nov 7, 2021

@sumitbh250 so you ended up copy the class to your local and updated the dependency like @drather19 mentioned? MessageDifferencer is exactly what I am looking for.

I see there is an open issue here google/truth#656

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants