Skip to content

Commit

Permalink
Change unit test accordingly for encoding backend jwt with padding
Browse files Browse the repository at this point in the history
  • Loading branch information
rmsamitha committed Jul 25, 2024
1 parent bf93272 commit 4258189
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4258189

Please sign in to comment.