From 425818944b7c7309ab239836d9be9133e35af731 Mon Sep 17 00:00:00 2001 From: rmsamitha Date: Thu, 25 Jul 2024 11:42:38 +0530 Subject: [PATCH] Change unit test accordingly for encoding backend jwt with padding --- .../AbstractAPIMgtGatewayJWTGeneratorTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/apimgt/org.wso2.carbon.apimgt.common.gateway/src/test/java/org/wso2/carbon/apimgt/common/gateway/jwtgenerator/AbstractAPIMgtGatewayJWTGeneratorTest.java b/components/apimgt/org.wso2.carbon.apimgt.common.gateway/src/test/java/org/wso2/carbon/apimgt/common/gateway/jwtgenerator/AbstractAPIMgtGatewayJWTGeneratorTest.java index b4a88e83e773..3cb6ab3ed7f8 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.common.gateway/src/test/java/org/wso2/carbon/apimgt/common/gateway/jwtgenerator/AbstractAPIMgtGatewayJWTGeneratorTest.java +++ b/components/apimgt/org.wso2.carbon.apimgt.common.gateway/src/test/java/org/wso2/carbon/apimgt/common/gateway/jwtgenerator/AbstractAPIMgtGatewayJWTGeneratorTest.java @@ -19,15 +19,25 @@ package org.wso2.carbon.apimgt.common.gateway.jwtgenerator; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; +import org.wso2.carbon.apimgt.common.gateway.dto.JWTConfigurationDto; import org.wso2.carbon.apimgt.common.gateway.exception.JWTGeneratorException; public class AbstractAPIMgtGatewayJWTGeneratorTest { + protected JWTConfigurationDto jwtConfigurationDto; + + @Before + public void setup() { + jwtConfigurationDto = new JWTConfigurationDto(); + jwtConfigurationDto.setEnableBase64Padding(false); + } @Test public void testEncode() { // Test whether the encode method is base64 encoding. AbstractAPIMgtGatewayJWTGenerator apiMgtGatewayJWTGenerator = new APIMgtGatewayJWTGeneratorImpl(); + apiMgtGatewayJWTGenerator.setJWTConfigurationDto(jwtConfigurationDto); String stringToBeEncoded = "<>"; String expectedEncodedString = "PDw/Pz8+Pg"; try {