All checks were successful
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 61.49% (17397/28294)
* Branch Coverage: 52.32% (6724/12852)
* Lines of Code: 28294
* Cyclomatic Complexity: 11339
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 15, passed: 608
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good
45 lines
1.5 KiB
Java
45 lines
1.5 KiB
Java
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());
|
|
}
|
|
|
|
@Test
|
|
void providerListingShouldExposeOnlyPbsByDefault() {
|
|
final var providers = FrontendRegistryService.listProviders();
|
|
|
|
assertEquals(1, providers.size());
|
|
assertEquals(PBSDefinitions.PBS.getLanguageId(), providers.getFirst().specification().getLanguageId());
|
|
}
|
|
}
|