implements PLN-0104

This commit is contained in:
2026-07-15 08:28:30 +01:00
parent f8b9c5b27d
commit 66c1b1a033
7 changed files with 103 additions and 12 deletions
@@ -0,0 +1,36 @@
package p.studio.compiler;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
class FrontendRegistryServiceTest {
@Test
void requireShouldResolveProviderByLanguageId() {
final var provider = FrontendRegistryService.require(PBSDefinitions.PBS.getLanguageId());
assertEquals(PBSDefinitions.PBS.getLanguageId(), provider.specification().getLanguageId());
assertSame(PBSDefinitions.PBS, provider.specification());
}
@Test
void requireShouldFailClearlyForUnknownLanguageId() {
final var thrown = assertThrows(
IllegalArgumentException.class,
() -> FrontendRegistryService.require("unknown-language"));
assertTrue(thrown.getMessage().contains("unknown-language"));
}
@Test
void specListingShouldBeProviderDerived() {
final var specs = FrontendRegistryService.listFrontendSpecs();
assertEquals(1, specs.size());
assertEquals(PBSDefinitions.PBS.getLanguageId(), specs.getFirst().getLanguageId());
}
}