TDD = Test Driven Development

The core idea of TDD is to write your tests before actually writing the code to implement the tests.

Pragmatic TDD Links

Additional JUnit asserts I'd like to have

  • assertNotEquals(Object expected, Object actual)
  • assertContains(String expectedPart, String actual) - String specific
  • assertMatches(String expectedRegex, String actual) - Regex match of a string
  • assertArrayEquals( Object[] expected, Object[] actual) — also for primitives
  • assertEqualityThroughReflection( ReflectionDetails methodsFieldsIgnores, Object expected, Object actual )
    • The way I've done this in the past it to have an external method and assertEquals, ex: assertEquals( convertToStringUsingReflection(expected), convertToStringUsingReflection(actual));
  • assertMethodReturnEquality( Method methodName, Object[] args, Object expected, Object actual)
    • equivalent to: assertEquals( expected.methodName(args), actual.methodName(actual)

Flexible JUnit assertions with assertThat()

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License