assertEquals("March", monthMap.get(3)); // JUnit
assertThat(monthMap).containsEntry(3, "March"); // Truth
ImmutableSet<String> colors = ImmutableSet.of("red", "green", "blue", "yellow");
assertTrue(colors.contains("orange")); // JUnit
assertThat(colors).contains("orange"); // Truth
The api seems very similar to AssertJ (https://github.com/joel-costigliola/assertj-core), both of which are a massive improvement over raw JUnit. I've been using AssertJ for probably 8 months and it's fantastic. Does Truth solve some problems that AssertJ does not?
Hi, I use AssertJ too and I have the same question that Steve.
Hi!Have you ever try to use rspec ruby gem through jRuby?In my opinion, rspec has the most advanced testing dsl language.Regards, Karlo.
Your case would be stronger if contrasted with modern JUnit, that is, `assertThat` + Hamcrest, rather than older constructs such as `assertEquals` or `assertTrue`. Yours is still a better API, but you make a bit of a strawman case against JUnit.
Exactly this! Also, did you try to work with the JUnit project to get this integrated or this just an other Google NIH project?
looks like just an other Google NIH project
can we use this with test automation using selenium webdriver
Sounds interesting. What advantage does this have over hamcrest?
You should checkout spock https://github.com/spockframework/spock
Any recommendation on how to use assertWithMessage? For instance assertWithMEssage("Check orange is present") or assertWithMessage("Orange is missing")
The comments you read and contribute here belong only to the person who posted them. We reserve the right to remove off-topic comments.