@Test
public void testColoredString() {

    String testString = "&7This &9is&l the &1string&3 under test.";
    String plainString = "This is the string under test.";
    String[] codeArray = {"&7", null, null, null, null, "&9", null, "&l",
            null, null, null, null, "&1", null, null, null, null, null, "&3", null, null,
            null, null, null, null, null, null, null, null, null, null};
    ColoredString cs = new ColoredString(testString);
    // Check length() method
    assertEquals(cs.length(), plainString.length());
    // Check charAt() method
    assertEquals(cs.charAt(5), 'i');
    // Check subSequence method
    assertEquals("is th", cs.subSequence(5, 10));
    // Basic setup tests
    assertEquals(plainString, cs.toString());
    assertArrayEquals(codeArray, cs.getCodeArray());
    assertEquals(testString, cs.getColoredString());
    assertEquals(plainString, cs.toString());
    // Replace with plain text
    Pattern p = Pattern.compile("test");
    ColoredString modified = cs.replaceText(p, "derp");
    assertEquals("This is the string under derp.", modified.toString());
    assertEquals("&7This &9is&l the &1string&3 under derp.", modified.getColoredString());
    // Replace with colored text
    p = Pattern.compile("string");
    modified = cs.replaceText(p, "&3r&4a&5i&6n&7b&8o&9w");
    assertEquals("This is the rainbow under test.", modified.toString());
    assertEquals("&7This &9is&l the &1&3r&4a&5i&6n&7b&8o&9w&3 under test.", modified.getColoredString());
}