@Test
    public void persistenceTest() throws Exception
    {
        PartitionedHashMap map = (PartitionedHashMap) getMapInstance( 16 );
        long totalSize = 0;
        int amount = 0;
        for ( long i = -456; i < 1029; i++ )
        {
            amount++;
            totalSize += Long.toString( i ).length();
            assertTrue( map.put( Long.toString( i ), i ) );
        }
        for ( long i = -456; i < 1029; i++ )
        {
            assertEquals( new Long( i ), map.get( Long.toString( i ) ) );
        }
        map.persistSome( totalSize );
        Field mapStore = PartitionedHashMap.class.getDeclaredField( "store" );
        mapStore.setAccessible( true );
        HashMap<WrappedString, ArrayHashMapOption> actualStore = (HashMap<WrappedString, ArrayHashMapOption>) mapStore.get( map );
        for ( Map.Entry<WrappedString, ArrayHashMapOption> entry : actualStore.entrySet() )
        {
            assertNull( entry.getValue().getValue() );
            assertFalse( entry.getValue().inMemory() );
        }
        map.get( "0" );
        boolean foundOneInMemory = false;
        for ( Map.Entry<WrappedString, ArrayHashMapOption> entry : actualStore.entrySet() )
        {
            if ( entry.getValue().inMemory() )
            {
                if ( foundOneInMemory )
                {
                    fail( "There can be only one (in memory)" );
                }
                else
                {
                    foundOneInMemory = true;
                }
            }
        }
        assertTrue( foundOneInMemory );

        for ( long i = -456; i < 1029; i++ )
        {
            assertEquals( new Long( i ), map.get( Long.toString( i ) ) );
        }
        for ( Map.Entry<WrappedString, ArrayHashMapOption> entry : actualStore.entrySet() )
        {
            assertNotNull( entry.getValue().getValue() );
            assertTrue( entry.getValue().inMemory() );
        }
    }