-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9939028
commit 103dde8
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
...est/java/org/geoserver/cloud/autoconfigure/wms/extensions/GraticuleConfigurationTest.java
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,65 @@ | ||
/* | ||
* Author : Adnovum Informatik AG | ||
*/ | ||
|
||
package org.geoserver.cloud.autoconfigure.wms.extensions; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.geoserver.platform.ModuleStatus; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.autoconfigure.AutoConfigurations; | ||
import org.springframework.boot.test.context.runner.ApplicationContextRunner; | ||
|
||
/** | ||
* Test suite for {@link GraticuleConfiguration} | ||
* | ||
* @since 1.8 | ||
*/ | ||
class GraticuleConfigurationTest { | ||
|
||
private ApplicationContextRunner contextRunner = | ||
new ApplicationContextRunner() | ||
.withConfiguration(AutoConfigurations.of(GraticuleConfiguration.class)); | ||
|
||
@Test | ||
void enabledByDefault() { | ||
testEnabled(); | ||
} | ||
|
||
@Test | ||
void enabledExplicitly() { | ||
contextRunner = contextRunner.withPropertyValues("geoserver.wms.graticule.enabled=true"); | ||
testEnabled(); | ||
} | ||
|
||
@Test | ||
void disabled() { | ||
contextRunner = contextRunner.withPropertyValues("geoserver.wms.graticule.enabled=false"); | ||
contextRunner | ||
.run( | ||
context -> | ||
assertThat(context) | ||
.getBean( | ||
"graticuleDisabledModuleStatus", ModuleStatus.class) | ||
.hasFieldOrPropertyWithValue("enabled", false)) | ||
.run( | ||
context -> | ||
assertThat(context) | ||
.doesNotHaveBean(GraticuleConfiguration.Enabled.class)) | ||
.run(context -> assertThat(context).doesNotHaveBean("graticuleStorePanel")); | ||
} | ||
|
||
void testEnabled() { | ||
contextRunner | ||
.run( | ||
context -> | ||
assertThat(context) | ||
.hasSingleBean(GraticuleConfiguration.Enabled.class)) | ||
.run(context -> assertThat(context).hasBean("graticuleStorePanel")) | ||
.run( | ||
context -> | ||
assertThat(context) | ||
.doesNotHaveBean("graticuleDisabledModuleStatus")); | ||
} | ||
} |