 <blockquote> <p>JUnit's assertEquals() and such - good for tests, but can't use in main code</p> </blockquote> <p>Nothing technically prevents you from using JUnit assetions (and/or Hamcrest matchers) in your main code. Just include the Junit jar in your classpath. It's usually not done but that's more of a convention than any technical limitation.</p> <p>Java 7 also introduced <code>Objects.requireNotNull(obj, message)</code> and similar methods although not as full featured as JUnit assertions. </p> <p>but I think if you want to go with a more standardized approach Guava's preconditions is probably best.</p>