1919 import org .junit .jupiter .api .AfterEach ;
2020 import org .junit .jupiter .api .BeforeEach ;
2121 import org .junit .jupiter .api .TestInfo ;
22- import org .junit .jupiter .api .extension .ExtendWith ;
22+ import org .junit .jupiter .api .extension .RegisterExtension ;
2323 import org .slf4j .Logger ;
2424 import org .slf4j .LoggerFactory ;
2525 import org .springframework .beans .factory .annotation .Autowired ;
2626 import org .springframework .test .context .junit .jupiter .SpringJUnitConfig ;
2727 import reactor .core .publisher .Mono ;
2828 import reactor .util .function .Tuple2 ;
29-
29+
3030 import java .io .ByteArrayOutputStream ;
3131 import java .io .File ;
3232 import java .io .FileInputStream ;
3535 import java .lang .reflect .Method ;
3636 import java .util .Optional ;
3737 import java .util .function .Consumer ;
38-
38+
3939 import static org .assertj .core .api .Assertions .assertThat ;
4040 import static org .cloudfoundry .util .tuple .TupleUtils .consumer ;
41-
41+
4242 @ SpringJUnitConfig (classes = IntegrationTestConfiguration .class )
43- @ ExtendWith (CloudFoundryVersionConditionalRule .class )
4443 public abstract class AbstractIntegrationTest {
45-
44+
4645 private final Logger logger = LoggerFactory .getLogger ("cloudfoundry-client.test" );
47-
46+
4847 public String testName ;
49-
48+
5049 @ Autowired
5150 protected NameFactory nameFactory ;
52-
51+
52+ @ Autowired
53+ @ RegisterExtension
54+ public CloudFoundryVersionConditionalRule cloudFoundryVersionConditionalRule ;
55+
5356 @ BeforeEach
5457 public void testEntry (TestInfo testInfo ) {
5558 Optional <Method > testMethod = testInfo .getTestMethod ();
@@ -58,33 +61,33 @@ public void testEntry(TestInfo testInfo) {
5861 }
5962 this .logger .debug (">> {} <<" , getTestName ());
6063 }
61-
64+
6265 @ AfterEach
6366 public final void testExit () {
6467 this .logger .debug ("<< {} >>" , getTestName ());
6568 }
66-
69+
6770 protected static Mono <byte []> getBytes (String path ) {
6871 try (InputStream in = new FileInputStream (new File ("src/test/resources" , path )); ByteArrayOutputStream out = new ByteArrayOutputStream ()) {
6972 byte [] buffer = new byte [8192 ];
7073 int len ;
71-
74+
7275 while ((len = in .read (buffer )) != -1 ) {
7376 out .write (buffer , 0 , len );
7477 }
75-
78+
7679 return Mono .just (out .toByteArray ());
7780 } catch (IOException e ) {
7881 throw new RuntimeException (e );
7982 }
8083 }
81-
84+
8285 protected static <T > Consumer <Tuple2 <T , T >> tupleEquality () {
8386 return consumer ((expected , actual ) -> assertThat (actual ).isEqualTo (expected ));
8487 }
85-
88+
8689 private String getTestName () {
8790 return String .format ("%s.%s" , this .getClass ().getSimpleName (), this .testName );
8891 }
89-
92+
9093 }
0 commit comments