Skip to content

Commit

Permalink
fixup! Add Graticule extension
Browse files Browse the repository at this point in the history
  • Loading branch information
vuilleumierc committed May 1, 2024
1 parent 9939028 commit 103dde8
Showing 1 changed file with 65 additions and 0 deletions.
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"));
}
}

0 comments on commit 103dde8

Please sign in to comment.