package Ġde . z al ando . z ally . rule . z al ando Ċ Ċ import Ġde . z al ando . z ally . swagger With Operations Ċ import Ġde . z al ando . z ally . test Config Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . Test Ċ Ċ class ĠNot Specify Standard ErrorCode s Rule Test Ġ{ ĊĠĠĠ Ġprivate Ġval Ġall HttpStatusCode s Ġ= Ġset Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" 2 0 0 ", Ġ" 3 0 1 ", Ġ" 4 0 0 ", Ġ" 4 0 1 ", Ġ" 4 0 3 ", Ġ" 4 0 4 ", Ġ" 4 0 5 ", Ġ" 4 0 6 ", Ġ" 4 0 8 ", Ġ" 4 1 0 ", Ġ" 4 2 8 ", Ġ" 4 2 9 ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" 5 0 0 ", Ġ" 5 0 1 ", Ġ" 5 0 3 ", Ġ" 3 0 4 ", Ġ" 2 0 1 ", Ġ" 2 0 2 ", Ġ" 2 0 4 ", Ġ" 3 0 3 ", Ġ" 4 0 9 ", Ġ" 4 1 2 ", Ġ" 4 1 5 ", Ġ" 4 2 3 " ĊĠĠĠ Ġ) ĊĠĠĠ Ġprivate Ġval Ġstandard ErrorCode s Ġ= Ġset Of (" 4 0 1 ", Ġ" 4 0 3 ", Ġ" 4 0 4 ", Ġ" 4 0 5 ", Ġ" 4 0 6 ", Ġ" 4 0 8 ", Ġ" 4 1 3 ", Ġ" 4 1 4 ", Ġ" 4 1 5 ", Ġ" 5 0 0 ", Ġ" 5 0 2 ", Ġ" 5 0 3 ", Ġ" 5 0 4 ") ĊĠĠĠ Ġprivate Ġval Ġnot Standard ErrorCode s Ġ= Ġall HttpStatusCode s Ġ- Ġstandard ErrorCode s ĊĊĠĠĠ Ġprivate Ġval Ġall Operations Ġ= ĠlistOf (" get ", Ġ" post ", Ġ" put ", Ġ" patch ", Ġ" delete ", Ġ" head ", Ġ" options ") ĊĊĠĠĠ Ġprivate Ġval Ġrule Ġ= ĠNot Specify Standard ErrorCode s Rule ( test Config ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Pass If ErrorCode Not Standard () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġoperations Ġ= Ġall Operations . associate By ({ Ġit Ġ}, Ġ{ Ġnot Standard ErrorCode s Ġ}) ĊĊĠĠĠĠĠĠĠ Ġval Ġswagger Ġ= Ġswagger With Operations ( operations ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( rule . validate ( swagger )). isNull () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Not Pass If ErrorCode Is Standard () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnot Standard ErrorCode Operations Ġ= Ġall Operations . associate By ({ Ġit Ġ}, Ġ{ Ġnot Standard ErrorCode s Ġ}) ĊĠĠĠĠĠĠĠ Ġval Ġstandard ErrorCode Operations Ġ= Ġall Operations . associate By ({ Ġit Ġ}, Ġ{ Ġstandard ErrorCode s Ġ}) ĊĠĠĠĠĠĠĠ Ġval Ġoperations Ġ= Ġnot Standard ErrorCode Operations Ġ+ Ġstandard ErrorCode Operations ĊĊĠĠĠĠĠĠĠ Ġval Ġswagger Ġ= Ġswagger With Operations ( operations ) ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Paths Ġ= Ġstandard ErrorCode Operations . flatMap Ġ{ Ġmethod Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmethod . value . map Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcode Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"/ test Ġ${ method . key . toUpperCase ()} Ġ$ code " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġviolation Ġ= Ġrule . validate ( swagger ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( violation ?. paths . or Empty ()). contains Exactly In Any Order (* expected Paths . to Typed Array ()) ĊĠĠĠ Ġ} Ċ } Ċ