Unit Testing Anti-Pattern: Misleading Tests

You’re testing the right thing, and the test passes, and everything is cool. Or is it? Check out this test: @Test public void encodeString_sizeAtEnd() { Encoder enc = new Encoder(); String result = enc.encode(“hello”); assertEquals(“hello5”, result); } This test looks ok. I bet that without looking at the implementation, you Read more…