|
| 1 | +/******************************************************************************* |
| 2 | + * Copyright (c) 2025 Eclipse RDF4J contributors. |
| 3 | + * |
| 4 | + * All rights reserved. This program and the accompanying materials |
| 5 | + * are made available under the terms of the Eclipse Distribution License v1.0 |
| 6 | + * which accompanies this distribution, and is available at |
| 7 | + * http://www.eclipse.org/org/documents/edl-v10.php. |
| 8 | + * |
| 9 | + * SPDX-License-Identifier: BSD-3-Clause |
| 10 | + *******************************************************************************/ |
| 11 | +// Some portions generated by Codex |
| 12 | +package org.eclipse.rdf4j.tools.serverboot.config; |
| 13 | + |
| 14 | +import static org.assertj.core.api.Assertions.assertThatCode; |
| 15 | + |
| 16 | +import java.util.Map; |
| 17 | + |
| 18 | +import org.junit.jupiter.api.Test; |
| 19 | +import org.springframework.core.env.ConfigurableEnvironment; |
| 20 | +import org.springframework.core.env.MapPropertySource; |
| 21 | +import org.springframework.core.env.StandardEnvironment; |
| 22 | + |
| 23 | +class SolrAutoConfigurationDisablerTest { |
| 24 | + |
| 25 | + @Test |
| 26 | + void updateEnvironmentDoesNotThrowWhenPropertySourceAlreadyPresent() { |
| 27 | + ConfigurableEnvironment environment = new StandardEnvironment(); |
| 28 | + environment.getPropertySources() |
| 29 | + .addFirst(new MapPropertySource("rdf4jSolrAutoConfiguration", |
| 30 | + Map.of("spring.autoconfigure.exclude", "com.example.ExistingAutoConfig"))); |
| 31 | + |
| 32 | + SolrAutoConfigurationDisabler disabler = new SolrAutoConfigurationDisabler(); |
| 33 | + |
| 34 | + assertThatCode(() -> disabler.postProcessEnvironment(environment, null)).doesNotThrowAnyException(); |
| 35 | + } |
| 36 | +} |
0 commit comments