Testing Java code snippets