Migrate Google Truth code to AssertJ

MSAL

Convert Google Truth assertions, subject types and their methods to AssertJ equivalents.

org.openrewrite.java.testing.truth.TruthCodeToAssertJ
mod run . --recipe=org.openrewrite.java.testing.truth.TruthCodeToAssertJ

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Convert Truth assert_() to AssertJ
  2. Convert Truth assertWithMessage to AssertJ
  3. Convert Truth Throwable assertions to AssertJ
  4. Migrate Truth custom subjects to AssertJ
  5. Change method name com.google.common.truth..* hasLength(int) to hasSize
  6. Change method name com.google.common.truth.StringSubject containsMatch(..) to matches
  7. Change method name com.google.common.truth.StringSubject doesNotContainMatch(..) to doesNotMatch
  8. Change type StringSubject to AbstractStringAssert
  9. Change method name com.google.common.truth.ComparableSubject isAtLeast(..) to isGreaterThanOrEqualTo
  10. Change method name com.google.common.truth.ComparableSubject isAtMost(..) to isLessThanOrEqualTo
  11. Change type ComparableSubject to AbstractComparableAssert
  12. Change method name com.google.common.truth.Subject isSameInstanceAs(..) to isSameAs
  13. Change method name com.google.common.truth.Subject isNotSameInstanceAs(..) to isNotSameAs
  14. Change type Subject to AbstractObjectAssert
  15. Change method name com.google.common.truth.IterableSubject containsExactlyElementsIn(..) to containsExactlyElementsOf
  16. Change method name com.google.common.truth.IterableSubject containsAnyIn(..) to containsAnyElementsOf
  17. Change method name com.google.common.truth.IterableSubject containsNoneIn(..) to doesNotContainAnyElementsOf
  18. Change method name com.google.common.truth.IterableSubject containsAllIn(..) to containsAll
  19. Change method name com.google.common.truth.IterableSubject containsAllOf(..) to contains
  20. Change method name com.google.common.truth.IterableSubject containsNoneOf(..) to doesNotContain
  21. Change type IterableSubject to AbstractIterableAssert
  22. Change method name com.google.common.truth.OptionalSubject hasValue(..) to contains
  23. Change type OptionalSubject to AbstractOptionalAssert
  24. Change type GuavaOptionalSubject to AbstractOptionalAssert
  25. Change method name org.assertj.core.api.AbstractMapAssert containsEntries(..) to contains
  26. Change type MapSubject to AbstractMapAssert
  27. Change method name com.google.common.truth.ObjectArraySubject asList() to containsExactly
  28. Change type ObjectArraySubject to AbstractObjectArrayAssert
  29. Change type BooleanSubject to AbstractBooleanAssert
  30. Change type IntegerSubject to AbstractIntegerAssert
  31. Change type LongSubject to AbstractLongAssert
  32. Change type DoubleSubject to AbstractDoubleAssert
  33. Change type FloatSubject to AbstractFloatAssert
  34. Change type BigDecimalSubject to AbstractBigDecimalAssert
  35. Change type PrimitiveBooleanArraySubject to AbstractBooleanArrayAssert
  36. Change type PrimitiveIntArraySubject to AbstractIntArrayAssert
  37. Change type PrimitiveLongArraySubject to AbstractLongArrayAssert
  38. Change type PrimitiveDoubleArraySubject to AbstractDoubleArrayAssert
  39. Change type PrimitiveFloatArraySubject to AbstractFloatArrayAssert
  40. Change type PrimitiveByteArraySubject to AbstractByteArrayAssert
  41. Change type PrimitiveCharArraySubject to AbstractCharArrayAssert
  42. Change type PrimitiveShortArraySubject to AbstractShortArrayAssert
  43. Change type Truth8 to Assertions
  44. Change type OptionalIntSubject to AbstractOptionalIntAssert
  45. Change type OptionalLongSubject to AbstractOptionalLongAssert
  46. Change type OptionalDoubleSubject to AbstractOptionalDoubleAssert
  47. Change type StreamSubject to ListAssert
  48. Change type IntStreamSubject to AbstractIntArrayAssert
  49. Change type LongStreamSubject to AbstractLongArrayAssert
  50. Change type PathSubject to AbstractPathAssert
  51. Change type ClassSubject to AbstractClassAssert
  52. Change type ThrowableSubject to AbstractThrowableAssert
  53. Change type Truth to Assertions