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:
Phillip Webb
2016-07-26 19:44:47 -07:00
parent a44cc196de
commit 296dc7132b
13 changed files with 289 additions and 377 deletions

View File

@@ -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