Last active
December 26, 2015 03:59
-
-
Save tomaslin/7089592 to your computer and use it in GitHub Desktop.
Cyclomatic complexity weirdness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.netflix.asgard | |
import spock.lang.Specification | |
import spock.lang.Unroll | |
@Unroll | |
class StylerSpec extends Specification { | |
void 'availability zone to style class'() { | |
expect: | |
Styler.availabilityZoneToStyleClass(zone) == styledClass | |
where: | |
zone || styledClass | |
'us-east-1a' || 'zoneA' | |
'us-east-1b' || 'zoneB' | |
'us-east-1c' || 'zoneC' | |
'us-east-1d' || 'zoneD' | |
'us-west-1a' || 'zoneA' | |
'us-west-1b' || 'zoneB' | |
'us-west-1c' || 'zoneC' | |
'eu-west-1a' || 'zoneA' | |
'eu-west-1b' || 'zoneB' | |
'eu-west-1c' || 'zoneC' | |
'ap-southeast-1a' || 'zoneA' | |
'ap-southeast-1b' || 'zoneB' | |
'ap-southeast-1c' || 'zoneC' | |
'ap-northeast-1a' || 'zoneA' | |
'ap-northeast-1b' || 'zoneB' | |
'ap-northeast-1c' || 'zoneC' | |
null || null | |
'' || null | |
'hello' || null | |
'us-east-1A' || null | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.netflix.asgard | |
import spock.lang.Specification | |
import spock.lang.Unroll | |
@Unroll | |
class StylerSpec extends Specification { | |
void 'availability zone to style class'() { | |
expect: | |
Styler.availabilityZoneToStyleClass(zone) == styledClass | |
where: | |
zone || styledClass | |
'us-east-1a' || 'zoneA' | |
'us-east-1b' || 'zoneB' | |
'us-east-1c' || 'zoneC' | |
'us-east-1d' || 'zoneD' | |
'us-west-1a' || 'zoneA' | |
'us-west-1b' || 'zoneB' | |
'us-west-1c' || 'zoneC' | |
'eu-west-1a' || 'zoneA' | |
'eu-west-1b' || 'zoneB' | |
'eu-west-1c' || 'zoneC' | |
'ap-southeast-1a' || 'zoneA' | |
'ap-southeast-1b' || 'zoneB' | |
'ap-southeast-1c' || 'zoneC' | |
'ap-northeast-1a' || 'zoneA' | |
'ap-northeast-1b' || 'zoneB' | |
'ap-northeast-1c' || 'zoneC' | |
} | |
void 'availability zone returns null'() { | |
expect: | |
Styler.availabilityZoneToStyleClass(zone) == null | |
where: | |
zone || _ | |
null || _ | |
'' || _ | |
'hello' || _ | |
'us-east-1A' || _ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment