Search in sources :

Example 1 with ClientTypeResolver

use of com.checkmarx.sdk.utils.scanner.client.ClientTypeResolver in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.

the class ClientTypeResolverTest method checkThatExceptionIsThrown.

private static void checkThatExceptionIsThrown(String url) {
    ClientTypeResolver resolver = new ClientTypeResolver(new RestClientConfig());
    try {
        resolver.determineClientType(url);
        Assert.fail("Expected exception, but didn't get any.");
    } catch (Exception e) {
        Assert.assertTrue("Unexpected exception type.", e instanceof ScannerRuntimeException);
        Assert.assertTrue("Exception message is empty.", StringUtils.isNotEmpty(e.getMessage()));
        log.info("Got an expected exception");
    }
}
Also used : ClientTypeResolver(com.checkmarx.sdk.utils.scanner.client.ClientTypeResolver) RestClientConfig(com.checkmarx.sdk.config.RestClientConfig) ScannerRuntimeException(com.checkmarx.sdk.exception.ScannerRuntimeException) ScannerRuntimeException(com.checkmarx.sdk.exception.ScannerRuntimeException)

Example 2 with ClientTypeResolver

use of com.checkmarx.sdk.utils.scanner.client.ClientTypeResolver in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.

the class ClientTypeResolverTest method testDetermineClientType.

private void testDetermineClientType(String urlPropName) {
    ClientTypeResolver resolver = new ClientTypeResolver(new RestClientConfig());
    ClientType clientType = resolver.determineClientType(urlPropName);
    Assert.assertNotNull("Client type is null.", clientType);
    Assert.assertTrue("Client ID is empty.", StringUtils.isNotEmpty(clientType.getClientId()));
    Assert.assertTrue("Scopes are empty.", StringUtils.isNotEmpty(clientType.getScopes()));
}
Also used : ClientType(com.checkmarx.sdk.dto.sca.ClientType) ClientTypeResolver(com.checkmarx.sdk.utils.scanner.client.ClientTypeResolver) RestClientConfig(com.checkmarx.sdk.config.RestClientConfig)

Aggregations

RestClientConfig (com.checkmarx.sdk.config.RestClientConfig)2 ClientTypeResolver (com.checkmarx.sdk.utils.scanner.client.ClientTypeResolver)2 ClientType (com.checkmarx.sdk.dto.sca.ClientType)1 ScannerRuntimeException (com.checkmarx.sdk.exception.ScannerRuntimeException)1