// Path: src/main/java/com/gikk/twirk/types/twitchMessage/TwitchMessage.java
// public interface TwitchMessage extends AbstractEmoteMessage {
// 
// 	/**Retrieves this message's tag segment. Should always starts with a @. Note that the
// 	 * Tag segment will look vastly different for different Twitch commands, and some won't
// 	 * even have a tag.
// 	 *
// 	 * @return The tag segment, or {@code ""} if no tag was present
// 	 */
// 	public String getTag();
// 
// 	/**Retrieves the message's prefix.<br><br>
// 	 *
// 	 * A typical Twitch message looks something line this:<br>
// 	 * <code>:name!name@name.tmi.twitch.tv COMMAND #channel :message</code> <br><br>
// 	 *
// 	 * The prefix is the part before the first space. It usually only contains data about the sender of
// 	 * the message, but it might sometimes contain other information (PING messages for example just have PING as
// 	 * their prefix).<br><br>
// 	 *
// 	 * @return The messages prefix
// 	 */
// 	public String getPrefix();
// 
// 	/**Retrieves the message's command.<br>
// 	 * The command tells us what action triggered this message being sent.<br><br>
// 	 *
// 	 * @return The message's command
// 	 */
// 	public String getCommand();
// 
// 	/**Retrieves the message's target.<br>
// 	 * The target tells us whom the message is intended towards. It can be a user,
//      * a channel, or something else (though mostly the channel).
//      * <p>
// 	 * This segment is not always present.
// 	 *
// 	 * @return The message's target, or {@code ""} if no target
// 	 */
// 	public String getTarget();
// 
// 	/**Retrieves the message's content.<br>
// 	 * The content is the commands parameters. Most often, this is the actual chat message, but it may be many
// 	 * other things for other commands.<br><br>
// 	 *
// 	 * This segment is not always present.
// 	 *
// 	 * @return The message's content, or {@code ""} if no content
// 	 */
// 	public String getContent();
// 
//     /**Tells whether this message was a cheer event or not.
//      *
//      * @return {@code true} if the message contains bits, <code>false</code> otherwise
//      */
//     public boolean isCheer();
// 
//     /**Fetches a list of all all cheers in this message. Each cheer is encapsulated in a {@link Cheer}.
// 	 * The list might be empty, if the message contained no cheers.
//      *
// 	 * @return List of emotes (might be empty)
// 	 */
//     public List<Cheer> getCheers();
// 
//     /**Fetches the total number of bits that this message contained.
//      * This method is short-hand for:
//      * <pre>
//      * int bits = 0;
//      * for(Cheer c : getCheers())
//      *      bits += c.getBits();
//      * return bits;
//      * </pre>
//      * @return number of bits
//      */
//     public int getBits();
// 
//     /**Fetches the {@link TagMap} that has parsed the message's tag into a key-value map.
//      * For a list of different identifiers that can occur in a tag, check the {@link TwitchTags} class.
//      */
//     public TagMap getTagMap();
// }
// 
// Path: src/main/java/com/gikk/twirk/types/twitchMessage/TwitchMessageBuilder.java
// public interface TwitchMessageBuilder {
// 
// 	/**Constructs a new {@link TwitchMessage} object from a chat line received from Twitch.<br>
// 	 * A valid chat line has 2-5 segments:<br>
// 	 * <code>@TAG<optional> :PREFIX COMMAND TARGET<optional> :CONTENT<optional></code>
// 	 * <br><br>
// 	 * From this chat line, we create a {@link TwitchMessage}. If certain parts are not present, the corresponding
// 	 * <code>get</code> method on the {@link TwitchMessage} will return an empty string.
// 	 *
// 	 * @param chatLine The chat line, <b>exactly</b> as received from Twitch
// 	 * @return A {@link TwitchMessage}, or <code>null</code> if a {@link TwitchMessage} could not be created
// 	 */
// 	public TwitchMessage build(String chatLine);
// 
//     static TwitchMessageBuilder getDefault(){
//         return new DefaultTwitchMessageBuilder();
//     }
// }


import com.gikk.twirk.types.twitchMessage.TwitchMessage;
import com.gikk.twirk.types.twitchMessage.TwitchMessageBuilder;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.*;
    @Test
    public void oddEmoteIdTest_whenStartsAndEndsWithLetter() {
        // Given
        String input = "@emotes=A123A:0-11 :anon!anon@anon.tmi.twitch.tv PRIVMSG #tv :1oggoThink2 what is that?";
        Emote e = new EmoteImpl().setPattern("1oggoThink2").setEmoteIDString("A123A").addIndices(0, 12);

        // When
        TwitchMessage message = TwitchMessageBuilder.getDefault().build(input);

        // Then
        checkEmotes(message, e);
    }

    @Test
    public void oddEmoteIdTest_whenEndsWithLetter() {
        // Given
        String input = "@emotes=123BW:0-12 :anon!anon@anon.tmi.twitch.tv PRIVMSG #tv :doggoThink_BW what is that?";
        Emote e = new EmoteImpl().setPattern("doggoThink_BW").setEmoteIDString("123BW").addIndices(0, 13);

        // When
        TwitchMessage message = TwitchMessageBuilder.getDefault().build(input);

        // Then
        checkEmotes(message, e);
    }

    @Test
    public void oddEmoteIdTest_whenEndsWithUnderscore() {
        // Given
        String input = "@emotes=123_BW:0-10 :anon!anon@anon.tmi.twitch.tv PRIVMSG #tv :doggoThink2 what is that?";
// Path: src/main/java/com/gikk/twirk/types/twitchMessage/TwitchMessage.java
// public interface TwitchMessage extends AbstractEmoteMessage {
// 
// 	/**Retrieves this message's tag segment. Should always starts with a @. Note that the
// 	 * Tag segment will look vastly different for different Twitch commands, and some won't
// 	 * even have a tag.
// 	 *
// 	 * @return The tag segment, or {@code ""} if no tag was present
// 	 */
// 	public String getTag();
// 
// 	/**Retrieves the message's prefix.<br><br>
// 	 *
// 	 * A typical Twitch message looks something line this:<br>
// 	 * <code>:name!name@name.tmi.twitch.tv COMMAND #channel :message</code> <br><br>
// 	 *
// 	 * The prefix is the part before the first space. It usually only contains data about the sender of
// 	 * the message, but it might sometimes contain other information (PING messages for example just have PING as
// 	 * their prefix).<br><br>
// 	 *
// 	 * @return The messages prefix
// 	 */
// 	public String getPrefix();
// 
// 	/**Retrieves the message's command.<br>
// 	 * The command tells us what action triggered this message being sent.<br><br>
// 	 *
// 	 * @return The message's command
// 	 */
// 	public String getCommand();
// 
// 	/**Retrieves the message's target.<br>
// 	 * The target tells us whom the message is intended towards. It can be a user,
//      * a channel, or something else (though mostly the channel).
//      * <p>
// 	 * This segment is not always present.
// 	 *
// 	 * @return The message's target, or {@code ""} if no target
// 	 */
// 	public String getTarget();
// 
// 	/**Retrieves the message's content.<br>
// 	 * The content is the commands parameters. Most often, this is the actual chat message, but it may be many
// 	 * other things for other commands.<br><br>
// 	 *
// 	 * This segment is not always present.
// 	 *
// 	 * @return The message's content, or {@code ""} if no content
// 	 */
// 	public String getContent();
// 
//     /**Tells whether this message was a cheer event or not.
//      *
//      * @return {@code true} if the message contains bits, <code>false</code> otherwise
//      */
//     public boolean isCheer();
// 
//     /**Fetches a list of all all cheers in this message. Each cheer is encapsulated in a {@link Cheer}.
// 	 * The list might be empty, if the message contained no cheers.
//      *
// 	 * @return List of emotes (might be empty)
// 	 */
//     public List<Cheer> getCheers();
// 
//     /**Fetches the total number of bits that this message contained.
//      * This method is short-hand for:
//      * <pre>
//      * int bits = 0;
//      * for(Cheer c : getCheers())
//      *      bits += c.getBits();
//      * return bits;
//      * </pre>
//      * @return number of bits
//      */
//     public int getBits();
// 
//     /**Fetches the {@link TagMap} that has parsed the message's tag into a key-value map.
//      * For a list of different identifiers that can occur in a tag, check the {@link TwitchTags} class.
//      */
//     public TagMap getTagMap();
// }
// 
// Path: src/main/java/com/gikk/twirk/types/twitchMessage/TwitchMessageBuilder.java
// public interface TwitchMessageBuilder {
// 
// 	/**Constructs a new {@link TwitchMessage} object from a chat line received from Twitch.<br>
// 	 * A valid chat line has 2-5 segments:<br>
// 	 * <code>@TAG<optional> :PREFIX COMMAND TARGET<optional> :CONTENT<optional></code>
// 	 * <br><br>
// 	 * From this chat line, we create a {@link TwitchMessage}. If certain parts are not present, the corresponding
// 	 * <code>get</code> method on the {@link TwitchMessage} will return an empty string.
// 	 *
// 	 * @param chatLine The chat line, <b>exactly</b> as received from Twitch
// 	 * @return A {@link TwitchMessage}, or <code>null</code> if a {@link TwitchMessage} could not be created
// 	 */
// 	public TwitchMessage build(String chatLine);
// 
//     static TwitchMessageBuilder getDefault(){
//         return new DefaultTwitchMessageBuilder();
//     }
// }


// Path: src/test/java/com/gikk/twirk/types/emote/TestEmote.java
import com.gikk.twirk.types.twitchMessage.TwitchMessage;
import com.gikk.twirk.types.twitchMessage.TwitchMessageBuilder;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.*;

    @Test
    public void oddEmoteIdTest_whenStartsAndEndsWithLetter() {
        // Given
        String input = "@emotes=A123A:0-11 :anon!anon@anon.tmi.twitch.tv PRIVMSG #tv :1oggoThink2 what is that?";
        Emote e = new EmoteImpl().setPattern("1oggoThink2").setEmoteIDString("A123A").addIndices(0, 12);

        // When
        TwitchMessage message = TwitchMessageBuilder.getDefault().build(input);

        // Then
        checkEmotes(message, e);
    }

    @Test
    public void oddEmoteIdTest_whenEndsWithLetter() {
        // Given
        String input = "@emotes=123BW:0-12 :anon!anon@anon.tmi.twitch.tv PRIVMSG #tv :doggoThink_BW what is that?";
        Emote e = new EmoteImpl().setPattern("doggoThink_BW").setEmoteIDString("123BW").addIndices(0, 13);

        // When
        TwitchMessage message = TwitchMessageBuilder.getDefault().build(input);

        // Then
        checkEmotes(message, e);
    }

    @Test
    public void oddEmoteIdTest_whenEndsWithUnderscore() {
        // Given
        String input = "@emotes=123_BW:0-10 :anon!anon@anon.tmi.twitch.tv PRIVMSG #tv :doggoThink2 what is that?";
        Emote e = new EmoteImpl().setPattern("doggoThink2").setEmoteIDString("123_BW").addIndices(0, 11);