package Ġio . github . lazy engine er . feed parser . namespaces Ċ Ċ import Ġio . github . lazy engine er . feed parser . Feed Parser Ċ import Ġio . github . lazy engine er . feed parser . model . feed . RSS Feed Ċ import Ġorg . am sh ove . k lu ent .` should Ġequal ` Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . xml pull . v 1 . Xml Pull Parser Ċ import Ġorg . xml pull . v 1 . Xml Pull Parser Factory Ċ import Ġjava . io . BufferedReader Ċ import Ġjava . io . ByteArray InputStream Ċ import Ġjava . io . InputStream Reader Ċ import Ġjava . io . Reader Ċ import Ġjava . util . Calendar Ċ import Ġjava . util . Date Ċ import Ġjava . util . G regorian Calendar Ċ import Ġjava . util . TimeZone Ċ Ċ class ĠD ub lin Core Namespace Parser Test Ġ{ ĊĊ ĉ private Ġlateinit Ġvar Ġr ss XML : ĠString Ċ ĉ private Ġlateinit Ġvar Ġxml Pull Parser : ĠXml Pull Parser Ċ ĉ private Ġlateinit Ġvar Ġfeed : ĠRSS Feed ĊĊ ĉ @ Before Ċ ĉ fun ĠsetUp () Ġ{ Ċĉ ĉ val Ġr ss XML Stream Ġ= Ġthis . java Class . class Loader !!. getResource AsStream (" mock _ dub lin core _ rss _ sample . xml ") Ċĉ ĉ val Ġr ss Reader Ġ= ĠBufferedReader ( InputStream Reader ( rss XML Stream )) Ċĉ ĉ val ĠstringBuilder Ġ= ĠStringBuilder () ĊĊĉ ĉ var Ġline : ĠString ? Ċĉ ĉ while Ġ( rss Reader . readLine () Ċĉĉĉĉĉ ĉ . also Ġ{ Ġline Ġ= Ġit Ġ} Ġ!= Ġnull Ċĉ ĉ ) Ġ{ Ċĉĉ ĉ string Builder . append ( line ) Ċĉĉĉĉ ĉ . append ('\ n ') Ċĉ ĉ } ĊĊĉ ĉ rss XML Ġ= ĠstringBuilder . toString () ĊĊĉ ĉ val Ġfactory Ġ= ĠXml Pull Parser Factory . newInstance () Ċĉ ĉ xml Pull Parser Ġ= Ġfactory . new Pull Parser () Ċĉ ĉ val Ġreader : ĠReader Ġ= ĠInputStreamReader ( ByteArray InputStream ( rss XML . toByteArray ())) Ċĉ ĉ xml Pull Parser . setInput ( reader ) ĊĊĉ ĉ feed Ġ= ĠFeed Parser . parse Feed ( rss XML , Ġxml Pull Parser ) Ġas ĠRSS Feed Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġ` parse Ġd ub lin Ġcore Ġnamespace Ġmock Ġxml Ġstring Ġshould Ġreturn Ġexpected Ġdc Ġelement `() Ġ{ Ċĉ ĉ val Ġcalendar Ġ= ĠG regorian Calendar ( 2 0 0 0 , ĠCalendar . J AN U ARY , Ġ 1 , Ġ 0 , Ġ 0 , Ġ 0 ) Ġ// 2 0 0 0 - 0 1 - 0 1 T 1 2 : 0 0 + 0 0 : 0 0 Ċĉ ĉ calendar . time Zone Ġ= ĠTime Zone . getTime Zone (" GMT ") ĊĊĉ ĉ feed . dub lin Core Namespace ?. title Ġ` should Ġequal ` Ġ" D ub lin ĠCore âĦ ¢ Ġin ĠXML " Ċĉ ĉ feed . dub lin Core Namespace ?. creator Ġ` should Ġequal ` Ġ" creator " Ċĉ ĉ feed . dub lin Core Namespace ?. subject Ġ` should Ġequal ` Ġ" sea food " Ċĉ ĉ feed . dub lin Core Namespace ?. description Ġ` should Ġequal ` Ġ" UK OL N Ġis Ġa Ġnational Ġfocus Ġof Ġexpert ise Ġin Ġdigital Ġinformation Ġmanagement . ĠIt Ġprovides Ġpolicy , Ġresearch Ġand Ġaware ness Ġservices Ġto Ġthe ĠUK Ġlibrary , Ġinformation Ġand Ġcult ural Ġher it age Ġcommunities . ĠUK OL N Ġis Ġbased Ġat Ġthe ĠUniversity Ġof ĠB ath ." Ċĉ ĉ feed . dub lin Core Namespace ?. publisher Ġ` should Ġequal ` Ġ" UK OL N , ĠUniversity Ġof ĠB ath " Ċĉ ĉ feed . dub lin Core Namespace ?. contributor Ġ` should Ġequal ` Ġ" contributor " Ċĉ ĉ feed . dub lin Core Namespace ?. date Ġ` should Ġequal ` ĠDate ( calendar . time In Millis ) Ċĉ ĉ feed . dub lin Core Namespace ?. type Ġ` should Ġequal ` Ġ" type " Ċĉ ĉ feed . dub lin Core Namespace ?. format Ġ` should Ġequal ` Ġ" format " Ċĉ ĉ feed . dub lin Core Namespace ?. identifier Ġ` should Ġequal ` Ġ" http :// www . uk ol n . ac . uk /" Ċĉ ĉ feed . dub lin Core Namespace ?. source Ġ` should Ġequal ` Ġ" source " Ċĉ ĉ feed . dub lin Core Namespace ?. language Ġ` should Ġequal ` Ġ" language " Ċĉ ĉ feed . dub lin Core Namespace ?. relation Ġ` should Ġequal ` Ġ" relation " Ċĉ ĉ feed . dub lin Core Namespace ?. coverage Ġ` should Ġequal ` Ġ" coverage " Ċĉ ĉ feed . dub lin Core Namespace ?. rights Ġ` should Ġequal ` Ġ" rights " Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġ` parse Ġd ub lin Ġcore Ġnamespace Ġmock Ġxml Ġstring Ġshould Ġreturn Ġexpected Ġdc Ġelement Ġfor Ġfirst Ġitem `() Ġ{ Ċĉ ĉ val Ġcalendar Ġ= ĠG regorian Calendar ( 2 0 0 0 , ĠCalendar . J AN U ARY , Ġ 1 , Ġ 0 , Ġ 0 , Ġ 0 ) Ġ// 2 0 0 0 - 0 1 - 0 1 T 1 2 : 0 0 + 0 0 : 0 0 Ċĉ ĉ calendar . time Zone Ġ= ĠTime Zone . getTime Zone (" GMT ") ĊĊĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. title Ġ` should Ġequal ` Ġ" title " Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. creator Ġ` should Ġequal ` Ġ" creator " Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. subject Ġ` should Ġequal ` Ġ" subject " Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. description Ġ` should Ġequal ` Ġ" description " Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. publisher Ġ` should Ġequal ` Ġ" publisher " Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. contributor Ġ` should Ġequal ` Ġ" contributor " Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. date Ġ` should Ġequal ` ĠDate ( calendar . time In Millis ) Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. type Ġ` should Ġequal ` Ġ" type " Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. format Ġ` should Ġequal ` Ġ" format " Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. identifier Ġ` should Ġequal ` Ġ" identifier " Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. source Ġ` should Ġequal ` Ġ" source " Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. language Ġ` should Ġequal ` Ġ" language " Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. relation Ġ` should Ġequal ` Ġ" relation " Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. coverage Ġ` should Ġequal ` Ġ" coverage " Ċĉ ĉ feed . items [ 0 ]. dub lin Core Namespace ?. rights Ġ` should Ġequal ` Ġ" rights " Ċ ĉ } Ċ } Ċ