package Ġuk . n hs . n hs x . core . headers Ċ Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġstri kt . api . expect That Ċ import Ġstri kt . assertions . isEqualTo Ċ import Ġuk . n hs . n hs x . core . headers . Mobile App Version . Unknown Ċ import Ġuk . n hs . n hs x . core . headers . Mobile App Version . Version Ċ import Ġuk . n hs . n hs x . core . headers . Mobile OS . Android Ċ import Ġuk . n hs . n hs x . core . headers . Mobile OS . iOS Ċ import Ġuk . n hs . n hs x . test helper . assertions . isEqualTo Json Ċ import Ġuk . n hs . n hs x . test helper . assertions . toJson Ċ Ċ class ĠUser Agent Test Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` serial izes Ġto ĠJSON Ġcorrectly `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġuser Agent Ġ= ĠUser Agent ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠVersion ( 4 , Ġ 3 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠAndroid , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠMobile OS Version . of (" 2 9 ") ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġexpect That ( userAgent ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. toJson () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo Json (""" {" app Version ":{" major ": 4 ," minor ": 3 ," patch ": 0 ," sem Ver ":" 4 . 3 . 0 "}," os ":" Android "," os Version ":" 2 9 "} """) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` extract s Ġapp Ġversion Ġcontaining Ġmajor Ġand Ġminor Ġonly `() Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = 4 . 3 , b = 1 3 8 ", ĠVersion ( 4 , Ġ 3 ), ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = iOS , o = 1 4 . 2 , v = 4 . 5 , b = 3 4 9 ", ĠVersion ( 4 , Ġ 5 ), ĠiOS , ĠMobile OS Version . of (" 1 4 . 2 ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` extract s Ġapp Ġos Ġversion `() Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = 4 . 3 , b = 1 3 8 ", ĠVersion ( 4 , Ġ 3 ), ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = iOS , o = 1 4 . 2 , v = 4 . 5 , b = 3 4 9 ", ĠVersion ( 4 , Ġ 5 ), ĠiOS , ĠMobile OS Version . of (" 1 4 . 2 ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` extract s Ġapp Ġversion Ġcontaining Ġmajor , Ġminor Ġand Ġpatch `() Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = 4 . 3 . 0 , b = 1 3 8 ", ĠVersion ( 4 , Ġ 3 , Ġ 0 ), ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = iOS , o = 1 4 . 2 , v = 4 . 5 . 1 , b = 3 4 9 ", ĠVersion ( 4 , Ġ 5 , Ġ 1 ), ĠiOS , ĠMobile OS Version . of (" 1 4 . 2 ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` handles Ġinvalid Ġversions Ġas Ġunknown `() Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Extraction (" none ", ĠUnknown , Ġnull , Ġnull ) ĊĠĠĠĠĠĠĠ Ġassert Extraction ("", ĠUnknown , Ġnull , Ġnull ) ĊĠĠĠĠĠĠĠ Ġassert Extraction (".", ĠUnknown , Ġnull , Ġnull ) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" =", ĠUnknown , Ġnull , Ġnull ) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 ,, b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v , b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = , b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v == , b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = ., b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = 4 ., b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v =. 4 , b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = 4 . 0 ., b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = 4 . 0 . 0 ., b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = 4 . 0 . 0 . 0 , b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = 4 . a , b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = 4 . 0 . 0 . a , b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = a . 4 , b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = a . b , b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = a . b . c , b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = abc , b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠĠĠĠĠ Ġassert Extraction (" p = Android , o = 2 9 , v = 4 = 1 ., b = 1 3 8 ", ĠUnknown , ĠAndroid , ĠMobile OS Version . of (" 2 9 ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġassert Extraction ( ĊĠĠĠĠĠĠĠ Ġvalue : ĠString , ĊĠĠĠĠĠĠĠ Ġapp Version : ĠMobile App Version , ĊĠĠĠĠĠĠĠ Ġos : ĠMobile OS ?, ĊĠĠĠĠĠĠĠ Ġos Version : ĠMobile OS Version ? ĊĠĠĠ Ġ) Ġ{ ĊĠĠĠĠĠĠĠ Ġexpect That ( UserAgent . of ( value )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġget ( UserAgent :: os Version ). isEqualTo ( os Version ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġget ( UserAgent :: app Version ). isEqualTo ( app Version ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġget ( UserAgent :: os ). isEqualTo ( os ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ