implements PLN-0104
This commit is contained in:
+36
@@ -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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user