static LineMessagingClientBuilder builder(ChannelTokenSupplier channelTokenSupplier) { return new LineMessagingClientBuilder().channelTokenSupplier(channelTokenSupplier); } }
@Test public void testBuildWithoutChannelToken() { assertThatThrownBy(() -> { new LineMessagingClientBuilder().build(); }).isInstanceOf(NullPointerException.class) .hasMessageContaining("channelTokenSupplier"); }
@Test public void testBuildWithFixedToken() throws InterruptedException { lineMessagingClient = new LineMessagingClientBuilder() .channelToken("MOCKED_TOKEN") .apiEndPoint("http://localhost:" + mockWebServer.getPort()) .build(); // Do lineMessagingClient.getProfile("TEST"); // Verify final RecordedRequest recordedRequest = mockWebServer.takeRequest(); assertThat(recordedRequest.getHeader("Authorization")) .isEqualTo("Bearer MOCKED_TOKEN"); }