#testing

Interesting Links, 1 Mar 2016

Happy March 1, it’s April Fool’s Day! Oh, wait… From ##java itself: Anthaas_> 99.7% of people who say C++ is faster are not capable of using the highly-skilled techniques required to make that true. Now, about how he collected the data to validate that statement… Gradle.org posted “Gradle vs Maven Feature Comparison“, with a description of “At long last, a comprehensive feature comparison of Maven vs Gradle that shows...

2 minute(s) read

Interesting Links, 27 Jan 2016

Mutation Testing: Watching the Watchmen talks about the need for mutation testing, in addition to addressing the desire for unit testing. His point is: unit testing is good – do it. But it’s often not enough, and he promises to go more into mutation testing as an enhancement in future posts. JOOQ has published If Java Were Designed Today: The Synchronizable Interface, discussing what could have been designed as opposed to what we got with...

2 minute(s) read

Expected Exceptions from JUnit

Use JUnit’s expected exceptions sparingly, from the JOOQ blog, says not to use JUnit‘s “expected exceptions” feature. (Or, more accurately, to use it “sparingly.”) It’s good advice, but it’s also largely limited to JUnit (with one main exception). What they’re addressing is the transition from this pattern: @Test public void testValueOfIntInvalid() { try { ubyte((UByte.MIN_VALUE) - 1); fail(); } catch (NumberFormatException e) {} } To this pattern: @Test(expected = NumberFormatException.class) public void testValueOfShortInvalidCase1...

4 minute(s) read

A set of testing tools

Petri Kainulainen posted “12 Tools That I Use for Writing Unit and Integration Tests,” which does a pretty good job of describing a set of testing tools and approaches, including solutions in the following categories: Running Tests Mock and Stub frameworks Writing Assertions Testing Data Access Testing Spring It’s not comprehensive (nor does it claim to be), with no mention of things like TestNG, Arquillian, Liquibase or Flyway, or testing CDI in general (see...

1 minute(s) read

Junit 4 examples

There seems to be some repeated questions about using JUnit. So I made a short example using JUnit 4 with ant. First here is the directory structure of my files. build build/build.sh build/build.xml lib lib/hamcrest-core-1.3.jar lib/junit-4.11.jar src src/org src/org/javachannel src/org/javachannel/SimulatedSpring.java test test/org test/org/javachannel test/org/javachannel/SimulatedSpringTest.java The class I want...

4 minute(s) read