question: public static void assertGTest ( final double [ ] expected , long [ ] observed , double alpha ) { if ( gTest ( expected , observed ) < alpha ) { StringBuilder msgBuffer = new StringBuilder ( ) ; DecimalFormat df = new DecimalFormat ( "#.##" ) ; msgBuffer . append ( "G test failed" ) ; msgBuffer . append ( " p-value = " ) ; msgBuffer . append ( gTest ( expected , observed ) ) ; msgBuffer . append ( ". \n" ) ; msgBuffer . append ( "value\texpected\tobserved\n" ) ; for ( int i = 0 ; i < expected . length ; i ++ ) { msgBuffer . append ( df . format ( expected [ i ] ) ) ; msgBuffer . append ( "\t\t" ) ; msgBuffer . append ( observed [ i ] ) ; msgBuffer . append ( "\n" ) ; } msgBuffer . append ( "This test can fail randomly due to sampling error with probability " ) ; msgBuffer . append ( alpha ) ; msgBuffer . append ( "." ) ; Assert . fail ( msgBuffer . toString ( ) ) ; } }
target:  Asserts the null hypothesis that the observed counts follow the given distribution implied by expected, using a G-test