Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-16467: Add check for working locale in TestSolrVersion (#1083)

Kevin Risden17fe8ac8c653
diff --git a/solr/core/src/test/org/apache/solr/util/TestSolrVersion.java b/solr/core/src/test/org/apache/solr/util/TestSolrVersion.java
index 1a43e7cab71..93822e83846 100644
--- a/solr/core/src/test/org/apache/solr/util/TestSolrVersion.java
+++ b/solr/core/src/test/org/apache/solr/util/TestSolrVersion.java
@@ -16,12 +16,28 @@
*/
package org.apache.solr.util;
+import java.util.Locale;
import org.apache.solr.SolrTestCase;
+import org.apache.solr.SolrTestCaseJ4;
+import org.junit.BeforeClass;
import org.semver4j.SemverException;
public class TestSolrVersion extends SolrTestCase {
private static final SolrVersion SOLR_9_0_1 = SolrVersion.valueOf("9.0.1");
+ @SuppressWarnings("AssertionFailureIgnored")
+ @BeforeClass
+ public static void beforeClass() {
+ // Checks that semver4j works with configured locale */
+ try {
+ assertTrue(SOLR_9_0_1.satisfies("~9.0"));
+ } catch (AssertionError e) {
+ SolrTestCaseJ4.assumeNoException(
+ "See SOLR-16467 - semver4j doesn't work with " + Locale.getDefault().toLanguageTag(),
+ new Exception(e));
+ }
+ }
+
public void testToString() {
assertEquals("9.0.0", SolrVersion.forIntegers(9, 0, 0).toString());
}