use of dev.jbang.source.sources.JavaSource in project jbang by jbangdev.
the class TestSource method testGav.
@Test
void testGav() {
Source src = new JavaSource(example, null);
String gav = src.getGav().get();
assertEquals("org.example:classpath", gav);
}
use of dev.jbang.source.sources.JavaSource in project jbang by jbangdev.
the class TestSource method testFindDependencies.
@Test
void testFindDependencies() {
Source src = new JavaSource(example, it -> PropertiesValueResolver.replaceProperties(it, new Properties()));
SourceSet ss = SourceSet.forSource(src);
List<String> deps = ss.getDependencies();
assertEquals(2, deps.size());
assertTrue(deps.contains("com.offbytwo:docopt:0.6.0.20150202"));
assertTrue(deps.contains("log4j:log4j:1.2.14"));
}
use of dev.jbang.source.sources.JavaSource in project jbang by jbangdev.
the class TestSource method testCommentsDoesNotGetPickedUp.
@Test
void testCommentsDoesNotGetPickedUp() {
Source source = new JavaSource(exampleCommandsWithComments, null);
SourceSet ss = SourceSet.forSource(source);
assertEquals(source.getJavaVersion(), "14+");
List<String> deps = ss.getDependencies();
assertThat(deps, containsInAnyOrder("info.picocli:picocli:4.5.0"));
}
use of dev.jbang.source.sources.JavaSource in project jbang by jbangdev.
the class TestSource method testCDS.
@Test
void testCDS() {
Source source = new JavaSource("//CDS\nclass m { }", null);
Source source2 = new JavaSource("class m { }", null);
assertTrue(source.enableCDS());
assertFalse(source2.enableCDS());
}
use of dev.jbang.source.sources.JavaSource in project jbang by jbangdev.
the class TestSource method testFindDependenciesWithProperty.
@Test
void testFindDependenciesWithProperty() {
Properties p = new Properties();
p.put("log4j.version", "1.2.9");
Source src = new JavaSource(example, it -> PropertiesValueResolver.replaceProperties(it, p));
SourceSet ss = SourceSet.forSource(src);
List<String> dependencies = ss.getDependencies();
assertEquals(2, dependencies.size());
assertTrue(dependencies.contains("com.offbytwo:docopt:0.6.0.20150202"));
assertTrue(dependencies.contains("log4j:log4j:1.2.9"));
}
Aggregations