Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 699 Bytes

template test integratation avec wiremock.md

File metadata and controls

27 lines (22 loc) · 699 Bytes

template de test d'intégration avec wiremock

@WireMockTest
class MonRepositoryTest {

    private static MonRepository monRepository;

    @BeforeAll()
    public static void prepare(WireMockRuntimeInfo wmRuntimeInfo) {
        var monMapper = new MonMapper();
        var httpClient = new HttpClient("mon-token-secret", wmRuntimeInfo.getHttpBaseUrl());
        monRepository = new MonRepository(httpClient, monMapper);
    }

    @Test
    public void mon_test() {
        // given
        stubFor(get("/api/client").willReturn(ok()));
        
        // when
        monRepository.handle();
        
        // then
        verify(getRequestedFor(urlEqualTo("/api/client")));
    }
}