package Ġio . github . sy kq . t cc Ċ Ċ import Ġorg . assertj . core . api . Assertions . LIST Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . jupiter . api . Assertions . assertFalse Ċ import Ġorg . junit . jupiter . api . Assertions . assertTrue Ċ import Ġorg . junit . jupiter . api . Test Ċ Ċ internal Ġclass ĠT mi Message Test Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġnot Ġbe Ġcre atable Ġdue Ġto Ġbad ly Ġformatted Ġpayload As Text `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpayload As Text Ġ= Ġ" just Some Text " ĊĠĠĠĠĠĠĠ ĠassertThat ( T mi Message . can Be Created From Payload As Text ( payload As Text )). isFalse ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġnot Ġbe Ġcre atable Ġfrom Ġpayload As Text `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpayload As Text Ġ= Ġ": test user ! test user @ test user . t mi . twitch . tv ĠPRIV MSG Ġ# test channel Ġ: 1 2 3 " ĊĠĠĠĠĠĠĠ ĠassertThat ( T mi Message . can Be Created From Payload As Text ( payload As Text )). isTrue ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġcreate Ġfrom ĠPRIV MSG Ġmessage Ġwithout Ġtags `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpayload As Text Ġ= Ġ": test user ! test user @ test user . t mi . twitch . tv ĠPRIV MSG Ġ# test channel Ġ: 1 2 3 " ĊĠĠĠĠĠĠĠ Ġval Ġt mi Message Ġ= ĠT mi Message . from Payload As Text ( payload As Text ) ĊĠĠĠĠĠĠĠ ĠassertThat ( t mi Message . type ). isEqualTo ( T mi MessageType . PRIV MSG ) ĊĠĠĠĠĠĠĠ ĠassertThat ( t mi Message . channel ). isEqualTo (" test channel ") ĊĠĠĠĠĠĠĠ ĠassertThat ( t mi Message . user ). isEqualTo (" test user ") ĊĠĠĠĠĠĠĠ ĠassertThat ( t mi Message . text ). isEqualTo (" 1 2 3 ") ĊĠĠĠĠĠĠĠ ĠassertThat ( t mi Message . tags . keyed ). isEmpty () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġcreate Ġfrom ĠPRIV MSG Ġmessage Ġwith Ġtags `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpayload As Text Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"@ badge - info = subscriber / 1 ; badges = vip / 1 , subscriber / 0 ; client - nonce = 6 a 5 6 2 3 dd 7 9 d 4 1 b 3 3 f 5 d 7 3 f 4 2 5 2 4 eda 0 f ; color =# D 2 6 9 1 E ; display - name = test user ; em ote - only = 1 ; em otes = 3 0 1 4 9 7 6 1 2 : 0 - 8 ; flags = ; id = adf 2 1 3 d 7 - 3 b 7 9 - 4 a 2 2 - 9 7 0 6 - d 4 8 7 1 c 3 ac 6 6 5 ; mod = 0 ; room - id = 9 8 9 1 6 8 1 5 ; subscriber = 1 ; t mi - sent - ts = 1 6 2 7 1 2 1 5 0 2 8 3 7 ; tur bo = 0 ; user - id = 1 3 1 4 1 8 7 7 0 ; user - type = Ġ: test user ! test user @ test user . t mi . twitch . tv ĠPRIV MSG Ġ# test channel Ġ: a Ġtest Ġmessage " ĊĠĠĠĠĠĠĠ Ġval Ġt mi Message Ġ= ĠT mi Message . from Payload As Text ( payload As Text ) ĊĠĠĠĠĠĠĠ ĠassertThat ( t mi Message . type ). isEqualTo ( T mi MessageType . PRIV MSG ) ĊĠĠĠĠĠĠĠ ĠassertThat ( t mi Message . channel ). isEqualTo (" test channel ") ĊĠĠĠĠĠĠĠ ĠassertThat ( t mi Message . user ). isEqualTo (" test user ") ĊĠĠĠĠĠĠĠ ĠassertThat ( t mi Message . text ). isEqualTo (" a Ġtest Ġmessage ") ĊĠĠĠĠĠĠĠ ĠassertThat ( t mi Message . tags . keyed ). has Size ( 1 6 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains Keys (" badge - info ", Ġ" user - type ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. extract ing ({ Ġit [" badges "] ?. values Ġ}, ĠLIST ). contains Exactly (" vip / 1 ", Ġ" subscriber / 0 ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` tags Ġshould Ġcontain Ġactive Ġsubscriber Ġtag `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpayload As Text Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"@ badge - info = subscriber / 1 ; badges = vip / 1 , subscriber / 4 2 ; client - nonce = 6 a 5 6 2 3 dd 7 9 d 4 1 b 3 3 f 5 d 7 3 f 4 2 5 2 4 eda 0 f ; color =# D 2 6 9 1 E ; display - name = test user ; em ote - only = 1 ; em otes = 3 0 1 4 9 7 6 1 2 : 0 - 8 ; flags = ; id = adf 2 1 3 d 7 - 3 b 7 9 - 4 a 2 2 - 9 7 0 6 - d 4 8 7 1 c 3 ac 6 6 5 ; mod = 0 ; room - id = 9 8 9 1 6 8 1 5 ; subscriber = 1 ; t mi - sent - ts = 1 6 2 7 1 2 1 5 0 2 8 3 7 ; tur bo = 0 ; user - id = 1 3 1 4 1 8 7 7 0 ; user - type = Ġ: test user ! test user @ test user . t mi . twitch . tv ĠPRIV MSG Ġ# test channel Ġ: a Ġtest Ġmessage " ĊĠĠĠĠĠĠĠ Ġval Ġt mi Message Ġ= ĠT mi Message . from Payload As Text ( payload As Text ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( t mi Message . is User Sub scribed ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` tags Ġshould Ġnot Ġcontain Ġactive Ġsubscriber Ġtag `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpayload As Text With Inactive Subscriber Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"@ badge - info = subscriber / 1 ; badges = vip / 1 , subscriber / 0 ; client - nonce = 6 a 5 6 2 3 dd 7 9 d 4 1 b 3 3 f 5 d 7 3 f 4 2 5 2 4 eda 0 f ; color =# D 2 6 9 1 E ; display - name = test user ; em ote - only = 1 ; em otes = 3 0 1 4 9 7 6 1 2 : 0 - 8 ; flags = ; id = adf 2 1 3 d 7 - 3 b 7 9 - 4 a 2 2 - 9 7 0 6 - d 4 8 7 1 c 3 ac 6 6 5 ; mod = 0 ; room - id = 9 8 9 1 6 8 1 5 ; subscriber = 0 ; t mi - sent - ts = 1 6 2 7 1 2 1 5 0 2 8 3 7 ; tur bo = 0 ; user - id = 1 3 1 4 1 8 7 7 0 ; user - type = Ġ: test user ! test user @ test user . t mi . twitch . tv ĠPRIV MSG Ġ# test channel Ġ: a Ġtest Ġmessage " ĊĠĠĠĠĠĠĠ Ġval Ġt mi Message With Inactive Subscriber Ġ= ĠT mi Message . from Payload As Text ( payload As Text With Inactive Subscriber ) ĊĠĠĠĠĠĠĠ ĠassertFalse ( t mi Message With Inactive Subscriber . is User Sub scribed ()) ĊĊĠĠĠĠĠĠĠ Ġval Ġpayload As Text Without Subscriber Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"@ badge - info = subscriber / 1 ; badges = vip / 1 , subscriber / 0 ; client - nonce = 6 a 5 6 2 3 dd 7 9 d 4 1 b 3 3 f 5 d 7 3 f 4 2 5 2 4 eda 0 f ; color =# D 2 6 9 1 E ; display - name = test user ; em ote - only = 1 ; em otes = 3 0 1 4 9 7 6 1 2 : 0 - 8 ; flags = ; id = adf 2 1 3 d 7 - 3 b 7 9 - 4 a 2 2 - 9 7 0 6 - d 4 8 7 1 c 3 ac 6 6 5 ; mod = 0 ; room - id = 9 8 9 1 6 8 1 5 ; t mi - sent - ts = 1 6 2 7 1 2 1 5 0 2 8 3 7 ; tur bo = 0 ; user - id = 1 3 1 4 1 8 7 7 0 ; user - type = Ġ: test user ! test user @ test user . t mi . twitch . tv ĠPRIV MSG Ġ# test channel Ġ: a Ġtest Ġmessage " ĊĠĠĠĠĠĠĠ Ġval Ġt mi Message Without Subscriber Ġ= ĠT mi Message . from Payload As Text ( payload As Text Without Subscriber ) ĊĠĠĠĠĠĠĠ ĠassertFalse ( t mi Message Without Subscriber . is User Sub scribed ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġcreate Ġsub Ġnotice Ġfrom ĠUSER NOTICE `() Ġ{ ĊĠĠĠĠĠĠĠ Ġ// Ġ\ s Ġis Ġprobably Ġa Ġwhitespace Ġcharacter Ġmarker ĊĠĠĠĠĠĠĠ Ġval Ġpayload As Text Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"@ badge - info = subscriber / 0 ; badges = subscriber / 0 , premium / 1 ; color = ; display - name = test user ; em otes = ; flags = ; id = f 5 5 a 3 7 d 8 - 1 1 7 5 - bbbb - aaaa - 7 aa 8 dd 4 a 8 2 7 7 ; login = test user ; mod = 0 ; msg - id = sub ; msg - param - cumulative - months = 1 ; msg - param - months = 0 ; msg - param - mult imon th - duration = 1 ; msg - param - mult imon th - ten ure = 0 ; msg - param - should - share - st reak = 0 ; msg - param - sub - plan - name = Channel \\ s Subscription \\ s ( test _ channel ); msg - param - sub - plan = 1 0 0 0 ; msg - param - was - gift ed = false ; room - id = 1 2 3 4 5 ; subscriber = 1 ; system - msg = test user \\ ss ub scribed \\ sat \\ s Tier \\ s 1 .; t mi - sent - ts = 1 6 2 9 5 8 0 7 8 3 0 8 9 ; user - id = 9 9 9 9 ; user - type = Ġ: t mi . twitch . tv ĠUSER NOTICE Ġ# test channel " ĊĠĠĠĠĠĠĠ Ġval Ġsub User Notice Ġ= ĠT mi Message . from Payload As Text ( payload As Text ) ĊĠĠĠĠĠĠĠ ĠassertThat ( sub User Notice . type ). isEqualTo ( T mi MessageType . USER NOTICE ) ĊĠĠĠĠĠĠĠ ĠassertThat ( sub User Notice . user ). isEqualTo (" test user ") ĊĠĠĠĠĠĠĠ ĠassertThat ( sub User Notice . channel ). isEqualTo (" test channel ") ĊĠĠĠĠĠĠĠ ĠassertThat ( sub User Notice . text ). isEqualTo (" test user \\ ss ub scribed \\ sat \\ s Tier \\ s 1 .") ĊĠĠĠ Ġ} Ċ Ċ } Ċ