33import org .junit .jupiter .api .Test ;
44import org .springframework .beans .factory .annotation .Autowired ;
55import org .springframework .boot .test .context .SpringBootTest ;
6+ import org .springframework .test .context .ContextConfiguration ;
67import org .wiremock .spring .ConfigureWireMock ;
78import org .wiremock .spring .EnableWireMock ;
89import uk .gov .hmcts .cp .subscription .clients .model .MaterialResponse ;
10+ import uk .gov .hmcts .cp .subscription .config .TestContainersInitialise ;
911
1012import java .util .UUID ;
1113
1214import static org .assertj .core .api .AssertionsForClassTypes .assertThat ;
1315import static org .assertj .core .api .AssertionsForClassTypes .assertThatThrownBy ;
1416
1517@ SpringBootTest
16- @ EnableWireMock ({@ ConfigureWireMock (name = "material-service" , baseUrlProperties = "material-service.url" )})
17- class MaterialServiceIntegrationTest {
18+ @ ContextConfiguration (initializers = TestContainersInitialise .class )
19+ @ EnableWireMock ({@ ConfigureWireMock (name = "material-client" , baseUrlProperties = "material-client.url" )})
20+ class MaterialClientIntegrationTest {
1821
1922 @ Autowired
20- private MaterialService materialService ;
23+ private MaterialClient materialClient ;
2124
2225 @ Test
2326 void should_return_material_by_id () {
2427
2528 final UUID materialId = UUID .fromString ("6c198796-08bb-4803-b456-fa0c29ca6021" );
26- MaterialResponse response = materialService .getByMaterialId (materialId );
29+ MaterialResponse response = materialClient .getByMaterialId (materialId );
2730
2831 assertThat (response ).satisfies (resp -> {
2932 assertThat (resp .getMaterialId ()).isEqualTo (materialId );
@@ -36,8 +39,7 @@ void should_return_material_by_id() {
3639 @ Test
3740 void should_throw_not_found_when_material_does_not_exist () {
3841 UUID materialId = UUID .fromString ("6c198796-08bb-4803-b456-fa0c29ca6022" );
39- assertThatThrownBy (() -> materialService .getByMaterialId (materialId ))
40- .isInstanceOf (feign .FeignException .NotFound .class )
41- .hasMessageContaining ("404" );
42+ assertThatThrownBy (() -> materialClient .getByMaterialId (materialId ))
43+ .isInstanceOf (feign .FeignException .NotFound .class );
4244 }
4345}
0 commit comments