question: private void keysSetTester ( Region pr , boolean keySet ) { assertEquals ( Collections . EMPTY_SET , ( keySet ? pr . keySet ( ) : pr . keys ( ) ) ) ; pr . put ( new Integer ( 1 ) , "won" ) ; pr . put ( new Integer ( 2 ) , "to" ) ; pr . put ( new Integer ( 3 ) , "free" ) ; pr . put ( new Integer ( 5 ) , "hive" ) ; final Set ks = ( keySet ? pr . keySet ( ) : pr . keys ( ) ) ; assertEquals ( 4 , ks . size ( ) ) ; try { ks . clear ( ) ; fail ( "Expected key set to be read only" ) ; } catch ( Exception expected ) { } try { ks . add ( "foo" ) ; fail ( "Expected key set to be read only" ) ; } catch ( Exception expected ) { } try { ks . addAll ( Arrays . asList ( new String [ ] { "one" , "two" , "three" } ) ) ; fail ( "Expected key set to be read only" ) ; } catch ( Exception expected ) { } try { ks . remove ( "boom" ) ; fail ( "Expected key set to be read only" ) ; } catch ( Exception expected ) { } try { ks . removeAll ( Arrays . asList ( new Integer [ ] { new Integer ( 1 ) , new Integer ( 2 ) } ) ) ; fail ( "Expected key set to be read only" ) ; } catch ( Exception expected ) { } try { ks . retainAll ( Arrays . asList ( new Integer [ ] { new Integer ( 3 ) , new Integer ( 5 ) } ) ) ; fail ( "Expected key set to be read only" ) ; } catch ( Exception expected ) { } final Iterator ksI = ks . iterator ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) { try { ksI . remove ( ) ; fail ( "Expected key set iterator to be read only" ) ; } catch ( Exception expected ) { } assertTrue ( ksI . hasNext ( ) ) ; Object key = ksI . next ( ) ; assertEquals ( Integer . class , key . getClass ( ) ) ; } try { ksI . remove ( ) ; fail ( "Expected key set iterator to be read only" ) ; } catch ( Exception expected ) { } try { ksI . next ( ) ; fail ( "Expected no such element exception" ) ; } catch ( NoSuchElementException expected ) { } }
target:  Test either the keySet() or keys() methods, which logically are expected to be the same