1+ package org .entur .example .web ;
2+
3+ import org .entur .example .web .rest .MyEntity ;
4+ import org .junit .jupiter .api .Test ;
5+ import org .springframework .beans .factory .annotation .Autowired ;
6+ import org .springframework .boot .test .context .SpringBootTest ;
7+ import org .springframework .boot .test .context .SpringBootTest .WebEnvironment ;
8+ import org .springframework .boot .test .web .client .TestRestTemplate ;
9+ import org .springframework .boot .test .web .server .LocalServerPort ;
10+ import org .springframework .http .HttpStatus ;
11+ import org .springframework .http .ResponseEntity ;
12+ import org .springframework .test .context .TestPropertySource ;
13+
14+ import static org .assertj .core .api .Assertions .assertThat ;
15+
16+ @ SpringBootTest (webEnvironment = WebEnvironment .RANDOM_PORT )
17+ @ TestPropertySource (properties = {
18+ "entur.logging.style=HumanReadableJson" ,
19+ })
20+ public class WebLoggingFormatViaPropertyTest {
21+
22+ @ LocalServerPort
23+ private int randomServerPort ;
24+
25+ @ Autowired
26+ private TestRestTemplate restTemplate ;
27+
28+ @ Test
29+ public void useHumanReadableJsonEncoderTest () throws InterruptedException {
30+ MyEntity entity = new MyEntity ();
31+ entity .setName ("Entur" );
32+ entity .setSecret ("mySecret" );
33+
34+ ResponseEntity <MyEntity > response = restTemplate .postForEntity ("/api/document/some/method" , entity , MyEntity .class );
35+ assertThat (response .getStatusCode ()).isEqualTo (HttpStatus .OK );
36+ }
37+
38+
39+ }
0 commit comments