@@ -53,7 +53,7 @@ public void noEmotesTest_whenShortTagIsPresent_thenGivesNoEmotes(){
5353 public void oneEmoteTest_whenFullTagIsPresent_thenParsesTheEmote (){
5454 //Given
5555 String input = "@badges=;color=#FF69B4;display-name=Gikklol;emotes=86:10-19;mod=0;room-id=31974228;subscriber=0;turbo=0;user-id=27658385;user-type= :nn!nn@nn.tmi.twitch.tv PRIVMSG #tv :beefin it BibleThump" ;
56- Emote e = new EmoteImpl ().setPattern ("BibleThump" ).setEmoteID (86 ).addIndices (10 , 20 );
56+ Emote e = new EmoteImpl ().setPattern ("BibleThump" ).setEmoteIDString ( "86" ). setEmoteID (86 ).addIndices (10 , 20 );
5757
5858 // When
5959 TwitchMessage message = TwitchMessageBuilder .getDefault ().build (input );
@@ -66,7 +66,7 @@ public void oneEmoteTest_whenFullTagIsPresent_thenParsesTheEmote(){
6666 public void oneEmoteTest_whenShortTagIsPresent_thenParsesTheEmote (){
6767 //Given
6868 String input = "@emotes=86:10-19 :nn!nn@nn.tmi.twitch.tv PRIVMSG #tv :beefin it BibleThump" ;
69- Emote e = new EmoteImpl ().setPattern ("BibleThump" ).setEmoteID (86 ).addIndices (10 , 20 );
69+ Emote e = new EmoteImpl ().setPattern ("BibleThump" ).setEmoteIDString ( "86" ). setEmoteID (86 ).addIndices (10 , 20 );
7070
7171 // When
7272 TwitchMessage message = TwitchMessageBuilder .getDefault ().build (input );
@@ -79,8 +79,8 @@ public void oneEmoteTest_whenShortTagIsPresent_thenParsesTheEmote(){
7979 public void multipleEmotesTest (){
8080 // Given
8181 String input = "@emotes=4685:4-9,11-16/15614:18-24; :anom!anon@anon.tmi.twitch.tv PRIVMSG #tv :Yo! tmrHat tmrHat tmrToad" ;
82- Emote e1 = new EmoteImpl ().setPattern ("tmrHat" ).setEmoteID (4685 ).addIndices (4 , 10 ).addIndices (11 , 17 );
83- Emote e2 = new EmoteImpl ().setPattern ("tmrToad" ).setEmoteID (15614 ).addIndices (18 , 25 );
82+ Emote e1 = new EmoteImpl ().setPattern ("tmrHat" ).setEmoteIDString ( "4685" ). setEmoteID (4685 ).addIndices (4 , 10 ).addIndices (11 , 17 );
83+ Emote e2 = new EmoteImpl ().setPattern ("tmrToad" ).setEmoteIDString ( "15614" ). setEmoteID (15614 ).addIndices (18 , 25 );
8484
8585 // When
8686 TwitchMessage message = TwitchMessageBuilder .getDefault ().build (input );
@@ -93,7 +93,7 @@ public void multipleEmotesTest(){
9393 public void modifiedEmoteTest () {
9494 // Given
9595 String input = "@emotes=123_BW:0-12 :anon!anon@anon.tmi.twitch.tv PRIVMSG #tv :doggoThink_BW what is that?" ;
96- Emote e = new EmoteImpl ().setPattern ("doggoThink_BW" ).setEmoteID (123 ).addIndices (0 , 13 );
96+ Emote e = new EmoteImpl ().setPattern ("doggoThink_BW" ).setEmoteIDString ( "123_BW" ). setEmoteID (123 ).addIndices (0 , 13 );
9797
9898 // When
9999 TwitchMessage message = TwitchMessageBuilder .getDefault ().build (input );
@@ -102,6 +102,85 @@ public void modifiedEmoteTest() {
102102 checkEmotes (message , e );
103103 }
104104
105+ @ Test
106+ public void oddEmoteIdTest_whenStartsAndEndsWithLetter () {
107+ // Given
108+ String input = "@emotes=A123A:0-11 :anon!anon@anon.tmi.twitch.tv PRIVMSG #tv :1oggoThink2 what is that?" ;
109+ Emote e = new EmoteImpl ().setPattern ("1oggoThink2" ).setEmoteIDString ("A123A" ).setEmoteID (123 ).addIndices (0 , 12 );
110+
111+ // When
112+ TwitchMessage message = TwitchMessageBuilder .getDefault ().build (input );
113+
114+ // Then
115+ checkEmotes (message , e );
116+ }
117+
118+ @ Test
119+ public void oddEmoteIdTest_whenEndsWithLetter () {
120+ // Given
121+ String input = "@emotes=123BW:0-12 :anon!anon@anon.tmi.twitch.tv PRIVMSG #tv :doggoThink_BW what is that?" ;
122+ Emote e = new EmoteImpl ().setPattern ("doggoThink_BW" ).setEmoteIDString ("123BW" ).setEmoteID (123 ).addIndices (0 , 13 );
123+
124+ // When
125+ TwitchMessage message = TwitchMessageBuilder .getDefault ().build (input );
126+
127+ // Then
128+ checkEmotes (message , e );
129+ }
130+
131+ @ Test
132+ public void oddEmoteIdTest_whenEndsWithUnderscore () {
133+ // Given
134+ String input = "@emotes=123_BW:0-10 :anon!anon@anon.tmi.twitch.tv PRIVMSG #tv :doggoThink2 what is that?" ;
135+ Emote e = new EmoteImpl ().setPattern ("doggoThink2" ).setEmoteIDString ("123_BW" ).setEmoteID (123 ).addIndices (0 , 11 );
136+
137+ // When
138+ TwitchMessage message = TwitchMessageBuilder .getDefault ().build (input );
139+
140+ // Then
141+ checkEmotes (message , e );
142+ }
143+
144+ @ Test
145+ public void oddEmoteIdTest_whenNoNumbers () {
146+ // Given
147+ String input = "@emotes=ABC_BW:0-10 :anon!anon@anon.tmi.twitch.tv PRIVMSG #tv :doggoThink2 what is that?" ;
148+ Emote e = new EmoteImpl ().setPattern ("doggoThink2" ).setEmoteIDString ("ABC_BW" ).setEmoteID (0 ).addIndices (0 , 11 );
149+
150+ // When
151+ TwitchMessage message = TwitchMessageBuilder .getDefault ().build (input );
152+
153+ // Then
154+ checkEmotes (message , e );
155+ }
156+
157+ @ Test
158+ public void oddEmoteIdTest_whenMissingCompletely () {
159+ // Given
160+ String input = "@emotes=:0-10 :anon!anon@anon.tmi.twitch.tv PRIVMSG #tv :doggoThink2 what is that?" ;
161+ Emote e = new EmoteImpl ().setPattern ("doggoThink2" ).setEmoteIDString ("" ).setEmoteID (0 ).addIndices (0 , 11 );
162+
163+ // When
164+ TwitchMessage message = TwitchMessageBuilder .getDefault ().build (input );
165+
166+ // Then
167+ checkEmotes (message , e );
168+ }
169+
170+ @ Test
171+ public void oddEmoteIdTest_whenMultipleOccurrences () {
172+ // Given
173+ String input = "@emotes=X123X:0-10,25-35/A1_B:12-15 :anon!anon@anon.tmi.twitch.tv PRIVMSG #tv :doggoThink2 what is that doggoThink2" ;
174+ Emote e1 = new EmoteImpl ().setPattern ("doggoThink2" ).setEmoteIDString ("X123X" ).setEmoteID (123 ).addIndices (0 , 11 ).addIndices (25 ,36 );
175+ Emote e2 = new EmoteImpl ().setPattern ("what" ).setEmoteIDString ("A1_B" ).setEmoteID (1 ).addIndices (12 , 16 );
176+
177+ // When
178+ TwitchMessage message = TwitchMessageBuilder .getDefault ().build (input );
179+
180+ // Then
181+ checkEmotes (message , e1 , e2 );
182+ }
183+
105184 private static void checkEmotes (TwitchMessage message , Emote ... emotes ){
106185 //Assert emote properties
107186 for ( int i = 0 ; i < emotes .length ; i ++){
0 commit comments