Skip to content

Commit

Permalink
added groovy unit test for new Piper step
Browse files Browse the repository at this point in the history
  • Loading branch information
Ran Li committed Jan 18, 2024
1 parent 4d6f0f5 commit d67d949
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,36 @@ class abapEnvironmentPipelineStageIntegrationTestsTest extends BasePiperTest {
'cloudFoundryCreateServiceKey')))
}

@Test
void testabapLandscapePortalUpdateAddOnProduct() {

nullScript.commonPipelineEnvironment.configuration.runStage = [
'Integration Tests': true
]
jsr.step.abapEnvironmentPipelineStageIntegrationTests(script: nullScript, integrationTestOption: 'addOnDeployment')


assertThat(stepsCalled, not(hasItem('input')))
assertThat(stepsCalled, hasItems('abapLandscapePortalUpdateAddOnProduct'))
}

@Test
void testabapLandscapePortalUpdateAddOnProductFails() {

helper.registerAllowedMethod('abapLandscapePortalUpdateAddOnProduct', [Map.class], {m -> stepsCalled.add('abapLandscapePortalUpdateAddOnProduct'); error("Failed")})

nullScript.commonPipelineEnvironment.configuration.runStage = [
'Integration Tests': true
]

try {
jsr.step.abapEnvironmentPipelineStageIntegrationTests(script: nullScript, integrationTestOption: 'addOnDeployment')
fail("Expected exception")
} catch (Exception e) {
// failure expected
}

assertThat(stepsCalled, not(hasItem('input')))
assertThat(stepsCalled, hasItems('abapLandscapePortalUpdateAddOnProduct'))
}
}

0 comments on commit d67d949

Please sign in to comment.