package Ġnet . tw ister rob . test . j fixture . examples Ċ Ċ import Ġcom . flex trade . j fixture . J Fixture Ċ import Ġnet . tw ister rob . test . j fixture . invoke Ċ import Ġorg . hamcrest . Matchers . empty String Ċ import Ġorg . hamcrest . Matchers . not Ċ import Ġorg . hamcrest . junit . Matcher Assert . assertThat Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . junit . jupiter . api . Method Order er . Random Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . Test Instance Ċ import Ġorg . junit . jupiter . api . Test Instance . Lifecycle . PER _ CLASS Ċ import Ġorg . junit . jupiter . api . Test Instance . Lifecycle . PER _ METHOD Ċ import Ġorg . junit . jupiter . api . TestMethod Order Ċ Ċ private Ġval Ġfixture Ġ= ĠJ Fixture () Ċ Ċ @ TestMethod Order ( Random :: class ) Ċ class ĠShared State Test Ġ{ ĊĊ ĉ @ Test Ġfun Ġcustom izer () Ġ{ Ċĉ ĉ fixture . custom ise (). same Instance ( String :: class . java , Ġ"") ĊĊĉ ĉ assertThat ( fixture < String >(), Ġempty String ()) Ċ ĉ } ĊĊ ĉ @ Test Ġfun Ġ` anno y ed Ġobserver `() Ġ{ Ċĉ ĉ assertThat ( fixture < String >(), Ġnot ( empty String ())) Ċ ĉ } Ċ } Ċ Ċ @ TestMethod Order ( Random :: class ) Ċ @ Test Instance ( PER _ CLASS ) Ġ// Ġcould Ġbe Ġconfigured Ġglobally Ġas Ġwell Ċ class ĠAl most Non Shared State Test Ġ{ ĊĊ ĉ private Ġval Ġfixture Ġ= ĠJ Fixture () ĊĊ ĉ @ Test Ġfun Ġcustom izer () Ġ{ Ċĉ ĉ fixture . custom ise (). same Instance ( String :: class . java , Ġ"") ĊĊĉ ĉ assertThat ( fixture < String >(), Ġempty String ()) Ċ ĉ } ĊĊ ĉ @ Test Ġfun Ġ` anno y ed Ġobserver `() Ġ{ Ċĉ ĉ assertThat ( fixture < String >(), Ġnot ( empty String ())) Ċ ĉ } Ċ } Ċ Ċ @ TestMethod Order ( Random :: class ) Ċ @ Test Instance ( PER _ METHOD ) Ġ// Ġdefault Ċ class ĠNon Shared State Test Ġ{ ĊĊ ĉ private Ġlateinit Ġvar Ġfixture : ĠJ Fixture ĊĊ ĉ @ BeforeEach Ġfun ĠsetUp () Ġ{ Ċĉ ĉ fixture Ġ= ĠJ Fixture () Ċ ĉ } ĊĊ ĉ @ Test Ġfun Ġcustom izer () Ġ{ Ċĉ ĉ fixture . custom ise (). same Instance ( String :: class . java , Ġ"") ĊĊĉ ĉ assertThat ( fixture < String >(), Ġempty String ()) Ċ ĉ } ĊĊ ĉ @ Test Ġfun Ġ` anno y ed Ġobserver `() Ġ{ Ċĉ ĉ assertThat ( fixture < String >(), Ġnot ( empty String ())) Ċ ĉ } Ċ } Ċ Ċ class ĠMy Fixture Ġ: ĠJ Fixture () Ġ{ Ċ ĉ init Ġ{ Ċĉ ĉ custom ise (). use SubType ( CharSequence :: class . java , ĠString :: class . java ) Ċ ĉ } Ċ } Ċ