h2/src/test/org/h2/test/unit/TestStringCache.java
/**
     * Test one string operation using the string cache.
     */
Test one string operation using the string cache.
Test one string operation using the string cache .
void testString() {
        String a = randomString();
        if (returnNew) {
            String b = StringUtils.fromCacheOrNew(a);
            try {
                assertEquals(a, b);
            } catch (Exception e) {
                TestBase.logError("error", e);
            }
            if (a != null && a == b && a.length() > 0) {
                throw new AssertionError("a=" + System.identityHashCode(a) + " b=" + System.identityHashCode(b));
            }
        } else {
            String b;
            if (useIntern) {
                b = a == null ? null : a.intern();
            } else {
                b = StringUtils.cache(a);
            }
            try {
                assertEquals(a, b);
            } catch (Exception e) {
                TestBase.logError("error", e);
            }
        }
    }
void testString ( ) { String a = randomString ( ) ; if ( returnNew ) { String b = StringUtils . fromCacheOrNew ( a ) ; try { assertEquals ( a , b ) ; } catch ( Exception e ) { TestBase . logError ( "error" , e ) ; } if ( a != null && a == b && a . length ( ) > 0 ) { throw new AssertionError ( "a=" + System . identityHashCode ( a ) + " b=" + System . identityHashCode ( b ) ) ; } } else { String b ; if ( useIntern ) { b = a == null ? null : a . intern ( ) ; } else { b = StringUtils . cache ( a ) ; } try { assertEquals ( a , b ) ; } catch ( Exception e ) { TestBase . logError ( "error" , e ) ; } } }
Test one string operation using the string cache.
Test one string operation using the string cache .