-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from aPureBase/v3.3.1
Revert naming strategy breaking change and add naming strategy enum f…
- Loading branch information
Showing
12 changed files
with
128 additions
and
16 deletions.
There are no files selected for viewing
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
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
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
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
16 changes: 16 additions & 0 deletions
16
arkenv/src/main/kotlin/com/apurebase/arkenv/argument/ArkenvArgumentNamingStrategy.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.apurebase.arkenv.argument | ||
|
||
/** | ||
* Determines how argument names are resolved. | ||
*/ | ||
enum class ArkenvArgumentNamingStrategy { | ||
/** | ||
* Always include the parameter name, even when custom names are specified. | ||
*/ | ||
ParameterNameAlwaysIncluded, | ||
|
||
/** | ||
* Only include the parameter name when no custom names are specified. | ||
*/ | ||
ParameterNameOnlyIfNotSpecified | ||
} |
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
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
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
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
41 changes: 41 additions & 0 deletions
41
arkenv/src/test/kotlin/com/apurebase/arkenv/argument/ArgumentNameProcessorTest.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.apurebase.arkenv.argument | ||
|
||
import org.junit.jupiter.api.Test | ||
import strikt.api.expectThat | ||
import strikt.assertions.hasSize | ||
|
||
internal class ArgumentNameProcessorTest { | ||
|
||
private val target = object { | ||
val argument: Int = 1 | ||
} | ||
|
||
@Test fun `processArgumentNames - ParameterNameOnlyIfNotSpecified - param name excluded`() { | ||
// Arrange | ||
val expected = "expected" | ||
val namingStrategy = ArkenvArgumentNamingStrategy.ParameterNameOnlyIfNotSpecified | ||
val processor = ArgumentNameProcessor(null, namingStrategy) | ||
val argument = Argument<Int>(listOf(expected)) | ||
|
||
// Act | ||
processor.processArgumentNames(argument, target::argument) | ||
|
||
// Assert | ||
expectThat(argument.names) { hasSize(1) } | ||
} | ||
|
||
@Test fun `processArgumentNames - ParameterNameAlwaysIncluded - param name included`() { | ||
// Arrange | ||
val expected = "expected" | ||
val namingStrategy = ArkenvArgumentNamingStrategy.ParameterNameAlwaysIncluded | ||
val processor = ArgumentNameProcessor(null, namingStrategy) | ||
val argument = Argument<Int>(listOf(expected)) | ||
|
||
// Act | ||
processor.processArgumentNames(argument, target::argument) | ||
|
||
// Assert | ||
expectThat(argument.names) { hasSize(2) } | ||
} | ||
|
||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |