// Ċ // ĠCopyright Ġ( C ) Ġ 2 0 1 8 - present ĠIn structure , ĠInc . Ċ // Ċ // ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ // Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ // ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ // Ċ // Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ // Ċ // ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ // Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ // ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ // ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ // Ġlimitations Ġunder Ġthe ĠLicense . Ċ // ĊĊĊ Ċ package Ġapi . buddy build Ċ Ċ import Ġnormal . to Normal Build Ċ import Ġorg . hamcrest . Matcher Assert . assertThat Ċ import Ġorg . hamcrest . Matchers Ċ import Ġorg . junit . Assert . assertEquals Ċ import Ġorg . junit . Assert . assertTrue Ċ import Ġorg . junit . Test Ċ import Ġorg . mockito . Mockito Ċ import Ġutil . date To Z oned Time Ċ Ċ class ĠBu ddy build Apps Test Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Apps () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= ĠBu ddy build Apps . get Apps () ĊĠĠĠĠĠĠĠ ĠassertThat ( result . size , ĠMatch ers . greater Than ( 1 )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Build s () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmock App Ġ= ĠMockito . mock ( Bu ddy build App Object :: class . java ) ĊĠĠĠĠĠĠĠ ĠMockito .` when `( mock App ._ id ). thenReturn (" 5 8 b 0 b 2 1 1 6 0 9 6 9 0 0 1 0 0 8 6 3 eb 8 ") ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= ĠBu ddy build Apps . get Build s ( mock App , Ġdate To Z oned Time (" 2 0 1 7 - 1 0 - 3 0 ")) ĊĠĠĠĠĠĠĠ ĠassertThat ( result . size , ĠMatch ers . greater Than ( 1 0 )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Test Results () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbuild Id Ġ= Ġ" 5 a 5 f 9 8 7 b 0 c 0 4 3 b 0 0 0 1 7 c 5 eaa " ĊĠĠĠĠĠĠĠ Ġval Ġresults Ġ= ĠBu ddy build Apps . getTest Results ( build Id ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( build Id , Ġresults . build _ id ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( results . tests . isNotEmpty ()) ĊĠĠĠĠĠĠĠ Ġresults . tests . forEach Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertTrue ( it . run . isNotEmpty ()) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertTrue ( it . target . isNotEmpty ()) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertTrue ( it . suite . isNotEmpty ()) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertTrue ( it . test . isNotEmpty ()) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertTrue ( it . status . isNotEmpty ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbu ddy build Build Object To Normal Build () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcreated _ at Ġ= Ġ" 2 0 1 7 - 1 0 - 3 1 T 2 1 : 2 6 : 0 4 . 3 2 3 Z " ĊĠĠĠĠĠĠĠ Ġval Ġstarted _ at Ġ= Ġ" 2 0 1 7 - 1 0 - 3 1 T 2 1 : 3 0 : 1 6 . 8 7 2 Z " ĊĠĠĠĠĠĠĠ Ġval Ġfinished _ at Ġ= Ġ" 2 0 1 7 - 1 0 - 3 1 T 2 1 : 4 3 : 4 4 . 6 1 5 Z " ĊĠĠĠĠĠĠĠ Ġval Ġ_ id Ġ= Ġ" 5 9 f 8 ea 6 ff fd 0 3 c 0 0 0 1 0 d 9 6 9 9 " ĊĠĠĠĠĠĠĠ Ġval Ġbuild _ status Ġ= Ġ" success " ĊĊĠĠĠĠĠĠĠ Ġval Ġmock Data Ġ= ĠMockito . mock ( Bu ddy build Build Object :: class . java ) ĊĠĠĠĠĠĠĠ ĠMockito .` when `( mock Data . created _ at ). thenReturn ( created _ at ) ĊĠĠĠĠĠĠĠ ĠMockito .` when `( mock Data . started _ at ). thenReturn ( started _ at ) ĊĠĠĠĠĠĠĠ ĠMockito .` when `( mock Data . finished _ at ). thenReturn ( finished _ at ) ĊĠĠĠĠĠĠĠ ĠMockito .` when `( mock Data ._ id ). thenReturn (_ id ) ĊĠĠĠĠĠĠĠ ĠMockito .` when `( mock Data . build _ status ). thenReturn ( build _ status ) ĊĊĠĠĠĠĠĠĠ Ġval Ġnormal Build Ġ= Ġmock Data . to Normal Build () !! ĊĠĠĠĠĠĠĠ ĠassertThat ( normal Build . build Id , ĠMatch ers .` is ` (_ id )) ĊĠĠĠĠĠĠĠ ĠassertThat ( normal Build . build Date , ĠMatch ers .` is ` (" 2 0 1 7 - 1 0 - 3 1 ")) ĊĠĠĠĠĠĠĠ ĠassertThat ( normal Build . build Year week , ĠMatch ers .` is ` (" 2 0 1 7 Ġ 4 4 ")) ĊĠĠĠĠĠĠĠ ĠassertThat ( normal Build . build Queued , ĠMatch ers .` is `( 2 5 2 L )) ĊĠĠĠĠĠĠĠ ĠassertThat ( normal Build . build Duration , ĠMatch ers .` is `( 8 0 7 L )) ĊĠĠĠĠĠĠĠ ĠassertThat ( normal Build . build Successful , ĠMatch ers .` is `( true )) ĊĠĠĠ Ġ} Ċ } Ċ