package Ġcom . t ng tech . apic enter . backend . connector . rest . mapper . converter Ċ Ċ import Ġcom . t ng tech . apic enter . backend . connector . rest . dto . Specification File Dto Ċ import Ġcom . t ng tech . apic enter . backend . connector . rest . service . Specification Data Parser Ċ import Ġcom . t ng tech . apic enter . backend . connector . rest . service . Specification File Downloader Ċ import Ġcom . t ng tech . apic enter . backend . domain . entity . Specification Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . given Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . mock Ċ import Ġcom . t ng tech . apic enter . backend . connector . rest . dto . Specification File Metadata Ċ import Ġcom . t ng tech . apic enter . backend . domain . entity . Api Language Ċ import Ġcom . t ng tech . apic enter . backend . domain . entity . Service Id Ċ import Ġcom . t ng tech . apic enter . backend . domain . entity . Specification Metadata Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ Ċ class ĠSpecification File Dto Converter Test Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠSW AG GER _ SPEC IFICATION Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"{\" swagger \": Ġ\" 2 . 0 \", Ġ\" info \": Ġ{ \" version \": Ġ\" 1 . 0 . 0 \",\" title \": Ġ\" Swagger ĠPet store \",\" description \":\" Description \" }}" ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠSW AG GER _ REMOTE Ġ= Ġ" https :// swagger . com / remote / file . json " ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠUUID _ STRING Ġ= Ġ" 5 aa 4 0 ba 9 - 7 e 2 6 - 4 4 de - 8 1 ec - f 5 4 5 d 1 f 1 7 8 aa " ĊĠĠĠ Ġ} ĊĠĠĠ Ġprivate Ġval Ġmetadata Ġ= ĠSpecification Metadata ( Service Id ( UUID _ STRING ), Ġ" Swagger ĠPet store ", Ġ" 1 . 0 . 0 ", Ġ" Description ", ĠApi Language . OPEN API , Ġnull ) ĊĊĠĠĠ Ġprivate Ġval Ġspecification Data Parser : ĠSpecification Data Parser Ġ= Ġmock () ĊĊĠĠĠ Ġprivate Ġval Ġspecification File Downloader : ĠSpecification File Downloader Ġ= Ġmock () ĊĊĠĠĠ Ġprivate Ġval Ġspecification File Dto Converter : ĠSpecification File Dto Converter Ġ= ĊĠĠĠĠĠĠĠ ĠSpecification File Dto Converter ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġspecification File Downloader , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġspecification Data Parser ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġgiven ( specification Data Parser . extract Title ( SW AG GER _ SPEC IFICATION )). willReturn (" Swagger ĠPet store ") ĊĠĠĠĠĠĠĠ Ġgiven ( specification Data Parser . extract Version ( SW AG GER _ SPEC IFICATION )). willReturn (" 1 . 0 . 0 ") ĊĠĠĠĠĠĠĠ Ġgiven ( specification Data Parser . extract Description ( SW AG GER _ SPEC IFICATION )). willReturn (" Description ") ĊĠĠĠĠĠĠĠ Ġgiven ( specification Data Parser . parse FileContent ( SW AG GER _ SPEC IFICATION )). willReturn ( SW AG GER _ SPEC IFICATION ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġconvert _ should Return Specification () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġspecification File Dto Ġ= ĠSpecification File Dto ( SW AG GER _ SPEC IFICATION , Ġid Ġ= ĠUUID _ STRING ) ĊĊĠĠĠĠĠĠĠ Ġgiven ( specification File Downloader . getLocal Or Remote FileContent ( specification File Dto )). willReturn ( SW AG GER _ SPEC IFICATION ) ĊĠĠĠĠĠĠĠ Ġgiven ( specification Data Parser . make Specification Metadata ( SW AG GER _ SPEC IFICATION , ĠUUID _ STRING )). willReturn ( metadata ) ĊĊĠĠĠĠĠĠĠ Ġval Ġspecification Ġ= Ġspecification File Dto Converter . convert ( specification File Dto , Ġnull , Ġnull ) ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Specification Ġ= ĠSpecification ( SW AG GER _ SPEC IFICATION , Ġmetadata ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( specification . content ). isEqualTo ( expected Specification . content ) ĊĠĠĠĠĠĠĠ ĠassertThat ( specification . metadata ). isEqualTo ( expected Specification . metadata ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġconvert _ should Return Remote Specification () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġspecification File Dto Ġ= ĠSpecification File Dto ( null , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠSW AG GER _ REMOTE , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġid Ġ= ĠUUID _ STRING ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġgiven ( specification File Downloader . retrieve File ( SW AG GER _ REMOTE )). willReturn ( SW AG GER _ SPEC IFICATION ) ĊĠĠĠĠĠĠĠ Ġgiven ( specification File Downloader . getLocal Or Remote FileContent ( specification File Dto )). willReturn ( SW AG GER _ SPEC IFICATION ) ĊĊĠĠĠĠĠĠĠ Ġgiven ( specification Data Parser . make Specification Metadata ( file Content Ġ= ĠSW AG GER _ SPEC IFICATION , Ġid From Path Ġ= ĠUUID _ STRING )). willReturn ( metadata ) ĊĊĠĠĠĠĠĠĠ Ġval Ġspecification Ġ= Ġspecification File Dto Converter . convert ( specification File Dto , Ġnull , Ġnull ) ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Specification Ġ= ĠSpecification ( SW AG GER _ SPEC IFICATION , Ġmetadata ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( specification . content ). isEqualTo ( expected Specification . content ) ĊĠĠĠĠĠĠĠ ĠassertThat ( specification . metadata ). isEqualTo ( expected Specification . metadata ) ĊĠĠĠ Ġ} Ċ }