void () { TextWithMnemonic hello = TextWithMnemonic.fromPlainText("hello"); assertTextWithoutSuffix(hello, "hello"); assertNoMnemonic(hello); assertMnemonicIndexOutOfBounds(hello, Integer.MAX_VALUE); assertMnemonicIndexOutOfBounds(hello, Integer.MIN_VALUE); assertMnemonicIndexOutOfBounds(hello, -2); assertMnemonicIndexOutOfBounds(hello, 5); TextWithMnemonic withMnemonic1 = hello.withMnemonicIndex(1); assertTextWithoutSuffix(withMnemonic1, "hello"); assertMnemonic(withMnemonic1, 1, KeyEvent.VK_E, 'e'); assertSame(withMnemonic1, withMnemonic1.withMnemonicIndex(1)); assertNotSame(withMnemonic1, hello); TextWithMnemonic withMnemonic3 = withMnemonic1.withMnemonicIndex(3); assertTextWithoutSuffix(withMnemonic3, "hello"); assertMnemonic(withMnemonic3, 3, KeyEvent.VK_L, 'l'); assertSame(withMnemonic3, withMnemonic3.withMnemonicIndex(3)); assertNotSame(withMnemonic3, withMnemonic1); TextWithMnemonic withoutMnemonic = withMnemonic3.withMnemonicIndex(-1); assertTextWithoutSuffix(withoutMnemonic, "hello"); assertNoMnemonic(withoutMnemonic); assertSame(withoutMnemonic, withoutMnemonic.withMnemonicIndex(-1)); assertNotSame(withoutMnemonic, withMnemonic1); assertNotSame(withoutMnemonic, withMnemonic3); assertNotSame(withoutMnemonic, hello); assertEquals(withoutMnemonic, hello); }