Skip to content

Commit

Permalink
Merge pull request #183 from Bindambc/fix/test-ci
Browse files Browse the repository at this point in the history
fix: test CI
  • Loading branch information
Bindambc authored May 7, 2024
2 parents bbe9f70 + 8fa05a1 commit f7f2cd1
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/test/java/com/whatsapp/api/WhatsappApiServiceGeneratorTest.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
package com.whatsapp.api;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

import java.io.IOException;
import java.net.ProxySelector;
import java.net.URISyntaxException;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import com.whatsapp.api.domain.errors.WhatsappApiError;
import com.whatsapp.api.exception.WhatsappApiException;
import com.whatsapp.api.utils.proxy.CustomHttpProxySelector;
import com.whatsapp.api.utils.proxy.CustomProxyAuthenticator;

import okhttp3.Authenticator;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.ResponseBody;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import retrofit2.Response;

public class WhatsappApiServiceGeneratorTest extends TestUtils {
import java.io.IOException;
import java.net.ProxySelector;
import java.net.URISyntaxException;

import static org.junit.jupiter.api.Assertions.*;


class WhatsappApiServiceGeneratorTest extends TestUtils {

@BeforeEach
void resetProxy() {
WhatsappApiServiceGenerator.sharedClient = WhatsappApiServiceGenerator.createDefaultHttpClient();
}


@AfterAll
static void resetSharedOkHttpClientToDefault() {
// reset the OkHttpClient to its default settings, preventing errors in other tests that do not utilize a proxy
WhatsappApiServiceGenerator.sharedClient = WhatsappApiServiceGenerator.createDefaultHttpClient();
}

/**
* Method under test:
* {@link WhatsappApiServiceGenerator#getSharedClient}
Expand All @@ -44,10 +48,6 @@ void testGetSharedClient() {
/**
* Method under test:
* {@link WhatsappApiServiceGenerator#getWhatsappApiError}
*
* @throws IOException
* @throws URISyntaxException
* @throws WhatsappApiException
*/
@Test
void testGetWhatsappApiError() throws IOException, URISyntaxException {
Expand All @@ -60,8 +60,8 @@ void testGetWhatsappApiError() throws IOException, URISyntaxException {
assertEquals(136025, apiError.error().code(), "Error code should be 136025");
assertEquals(2388093, apiError.error().errorSubcode(), "Error code should be 136025");
assertEquals(false, apiError.error().isTransient(), "Error code should be 136025");
assertEquals("O c\u00F3digo inserido est\u00E1 incorreto.", apiError.error().errorUserMsg(), "Error code should be 136025");
assertEquals("N\u00E3o foi poss\u00EDvel verificar o c\u00F3digo", apiError.error().errorUserSubtitle(), "Error code should be 136025");
assertEquals("O código inserido está incorreto.", apiError.error().errorUserMsg(), "Error code should be 136025");
assertEquals("Não foi possível verificar o código", apiError.error().errorUserSubtitle(), "Error code should be 136025");

}

Expand Down

0 comments on commit f7f2cd1

Please sign in to comment.