Allow UriTemplate to be built with an empty template

See gh-32432
This commit is contained in:
Kasper Bisgaard
2024-03-13 10:20:27 +01:00
committed by Stéphane Nicoll
parent 723c94e5ac
commit 1b25a1506a
2 changed files with 12 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.assertThatNoException;
/**
* @author Arjen Poutsma
@@ -218,4 +219,14 @@ class UriTemplateTests {
assertThat(uri.toString()).isEqualTo("http://localhost/query=foo@bar");
}
@Test
void emptyPathDoesNotThrowException() {
assertThatNoException().isThrownBy(() -> new UriTemplate(""));
}
@Test
void emptyPathThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> new UriTemplate(null));
}
}