Allow JSON Testers to be @Autowired
Switch `@AutoConfigureJsonTesters` to use regular `@Autowired` injection for JSON testers. Prior to this commit JSON Tester fields were initialized directly which caused IDE issues and was also a little confusing. Fixes gh-6451
This commit is contained in:
@@ -19,6 +19,7 @@ package sample.test.service;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.json.JsonTest;
|
||||
import org.springframework.boot.test.json.JacksonTester;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -34,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@JsonTest
|
||||
public class VehicleDetailsJsonTests {
|
||||
|
||||
@Autowired
|
||||
private JacksonTester<VehicleDetails> json;
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user