Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lashinijay committed Nov 19, 2024
1 parent 3695624 commit d5062fb
Show file tree
Hide file tree
Showing 3 changed files with 707 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/org.wso2.carbon.identity.api.server.dcr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@
<artifactId>jaxp-ri</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.testutil</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.common.testng.WithCarbonHome;
import org.wso2.carbon.identity.oauth.dcr.exception.DCRMException;
import org.wso2.carbon.identity.oauth.dcr.service.DCRMService;
import org.wso2.carbon.identity.oauth2.dcr.endpoint.dto.RegistrationRequestDTO;
import org.wso2.carbon.identity.oauth2.dcr.endpoint.dto.UpdateRequestDTO;
import org.wso2.carbon.identity.oauth2.dcr.endpoint.exceptions.DCRMEndpointException;
Expand All @@ -32,12 +36,27 @@

import javax.ws.rs.core.Response;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.when;

@WithCarbonHome
public class DCRMUtilsTest {

private List<String> redirectUris = new ArrayList<>();
private List<String> grantTypes = new ArrayList<>();
private final String clientName = "Application";

@BeforeClass
public void setup() {

mockStatic(PrivilegedCarbonContext.class);
PrivilegedCarbonContext privilegedCarbonContext = mock(PrivilegedCarbonContext.class);
when(PrivilegedCarbonContext.getThreadLocalCarbonContext()).thenReturn(privilegedCarbonContext);
when(PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(DCRMService.class, null))
.thenReturn(mock(DCRMService.class));
}

@BeforeMethod
public void setUp() throws Exception {

Expand Down
Loading

0 comments on commit d5062fb

Please sign in to comment.