Dylan Bolger
05/29/2024, 12:18 PMuseJUnitPlatform()
without relying on the internal JUnitPlatformTestFramework
class?
Currently I'm using this to check:
project.tasks.withType(Test).forEach {
assert it.testLogging.exceptionFormat == TestExceptionFormat.FULL
assert it.testFramework instanceof JUnitPlatformTestFramework
}
I'd also like to test against the ResolutionStrategy.cacheChangingModulesFor(int value, TimeUnit units)
method to confirm behavior is working as expected. For this one I've been reliant on the DefaultCachePolicy
internal class (since I'm doing a cast to a DefaultResolutionStrategy
(also internal)) and then accessing the cachePolicy
field.Adam
05/29/2024, 12:27 PMtasks.test {
useJUnitPlatform()
assert getOptions() instanceof JUnitPlatformOptions
}
Adam
05/29/2024, 12:28 PMDylan Bolger
05/29/2024, 12:30 PMDylan Bolger
05/29/2024, 12:53 PMproject.configurations.forEach {
assert ((DefaultCachePolicy)((DefaultResolutionStrategy) it.resolutionStrategy).cachePolicy).keepChangingModulesFor == 0
}
Adam
05/29/2024, 1:18 PMDylan Bolger
05/29/2024, 1:19 PMProjectBuilder.builder().build()
to create a test project to see if defaults provided by the plugin are being applied.Adam
05/29/2024, 1:19 PMAdam
05/29/2024, 1:19 PMAdam
05/29/2024, 1:20 PMcacheChangingModulesFor()
?Dylan Bolger
05/29/2024, 1:28 PMDylan Bolger
05/29/2024, 1:48 PMproject.configurations.forEach {
100 * it.resolutionStrategy.cacheChangingModulesFor(_, _)
}
Dylan Bolger
05/29/2024, 5:06 PMResolutionStrategy
objects, so this wouldn't work.