1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

Changing IllegalArgumentException to general Exception

Requested by Oliver Nocon
This commit is contained in:
Milko Todorov 2018-01-17 11:19:02 +01:00
parent 98a0c5b548
commit 62b0cae3ac
2 changed files with 6 additions and 6 deletions

View File

@ -229,7 +229,7 @@ class NeoDeploymentTest extends PiperTestBase {
void illegalDeployModeTest() {
new File(warArchivePath) << "dummy war archive"
thrown.expect(IllegalArgumentException)
thrown.expect(Exception)
thrown.expectMessage("[neoDeploy] Invalid deployMode = 'illegalMode'. Valid 'deployMode' values are: 'mta', 'warParams' and 'warPropertiesFile'")
withPipeline(warParamsDeployModePipeline()).execute(warArchivePath, 'illegalMode', 'lite', 'deploy')
@ -239,7 +239,7 @@ class NeoDeploymentTest extends PiperTestBase {
void illegalVMSizeTest() {
new File(warArchivePath) << "dummy war archive"
thrown.expect(IllegalArgumentException)
thrown.expect(Exception)
thrown.expectMessage("[neoDeploy] Invalid vmSize = 'illegalVM'. Valid 'vmSize' values are: 'lite', 'pro', 'prem' and 'prem-plus'.")
withPipeline(warParamsDeployModePipeline()).execute(warArchivePath, 'warParams', 'illegalVM', 'deploy')
@ -249,7 +249,7 @@ class NeoDeploymentTest extends PiperTestBase {
void illegalWARActionTest() {
new File(warArchivePath) << "dummy war archive"
thrown.expect(IllegalArgumentException)
thrown.expect(Exception)
thrown.expectMessage("[neoDeploy] Invalid warAction = 'illegalWARAction'. Valid 'warAction' values are: 'deploy' and 'rolling-update'.")
withPipeline(warParamsDeployModePipeline()).execute(warArchivePath, 'warParams', 'lite', 'illegalWARAction')

View File

@ -22,7 +22,7 @@ def call(parameters = [:]) {
def deployMode = utils.getMandatoryParameter(parameters, 'deployMode', 'mta')
if (deployMode != 'mta' && deployMode != 'warParams' && deployMode != 'warPropertiesFile') {
throw new IllegalArgumentException("[neoDeploy] Invalid deployMode = '${deployMode}'. Valid 'deployMode' values are: 'mta', 'warParams' and 'warPropertiesFile'")
throw new Exception("[neoDeploy] Invalid deployMode = '${deployMode}'. Valid 'deployMode' values are: 'mta', 'warParams' and 'warPropertiesFile'")
}
def propertiesFile
@ -30,7 +30,7 @@ def call(parameters = [:]) {
if (deployMode == 'warPropertiesFile' || deployMode == 'warParams') {
warAction = utils.getMandatoryParameter(parameters, 'warAction', 'deploy')
if (warAction != 'warAction' && warAction != 'deploy') {
throw new IllegalArgumentException("[neoDeploy] Invalid warAction = '${warAction}'. Valid 'warAction' values are: 'deploy' and 'rolling-update'.")
throw new Exception("[neoDeploy] Invalid warAction = '${warAction}'. Valid 'warAction' values are: 'deploy' and 'rolling-update'.")
}
}
if (deployMode == 'warPropertiesFile') {
@ -53,7 +53,7 @@ def call(parameters = [:]) {
runtimeVersion = utils.getMandatoryParameter(parameters, 'runtimeVersion', null)
vmSize = utils.getMandatoryParameter(parameters, 'vmSize', 'lite')
if (vmSize != 'lite' && vmSize !='pro' && vmSize != 'prem' && vmSize != 'prem-plus') {
throw new IllegalArgumentException("[neoDeploy] Invalid vmSize = '${vmSize}'. Valid 'vmSize' values are: 'lite', 'pro', 'prem' and 'prem-plus'.")
throw new Exception("[neoDeploy] Invalid vmSize = '${vmSize}'. Valid 'vmSize' values are: 'lite', 'pro', 'prem' and 'prem-plus'.")
}
}