use of org.wso2.carbon.apimgt.api.ApplicationNameWhiteSpaceValidationException in project carbon-apimgt by wso2.
the class RestApiUtilTest method testisDueToApplicationNameWhiteSpaceValidation.
@Test
public void testisDueToApplicationNameWhiteSpaceValidation() throws Exception {
ApplicationNameWhiteSpaceValidationException applicationNameWhiteSpaceValidationException = new ApplicationNameWhiteSpaceValidationException("New Sample exception");
Throwable testThrowable = new Throwable();
PowerMockito.spy(RestApiUtil.class);
PowerMockito.doReturn(applicationNameWhiteSpaceValidationException).when(RestApiUtil.class, "getPossibleErrorCause", testThrowable);
Assert.assertTrue("Invalid exception has been passed.", RestApiUtil.isDueToApplicationNameWhiteSpaceValidation(testThrowable));
}
use of org.wso2.carbon.apimgt.api.ApplicationNameWhiteSpaceValidationException in project carbon-apimgt by wso2.
the class RestApiUtilTest method testisDueToApplicationNameWithInvalidCharactersWithInvalidException.
@Test
public void testisDueToApplicationNameWithInvalidCharactersWithInvalidException() throws Exception {
ApplicationNameWhiteSpaceValidationException applicationNameWhiteSpaceValidationException = new ApplicationNameWhiteSpaceValidationException("New Sample exception");
Throwable testThrowable = new Throwable();
PowerMockito.spy(RestApiUtil.class);
PowerMockito.doReturn(applicationNameWhiteSpaceValidationException).when(RestApiUtil.class, "getPossibleErrorCause", testThrowable);
Assert.assertFalse("Invalid exception has been passed.", RestApiUtil.isDueToApplicationNameWithInvalidCharacters(testThrowable));
}
Aggregations