MCPcopy Create free account
hub / github.com/apache/camel-k / TestParseJavaFile

Function TestParseJavaFile

pkg/util/modeline/parser_test.go:27–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func TestParseJavaFile(t *testing.T) {
28 it := `
29 // camel-k: pippo=pluto paperino ciao=1
30 // camel-k : ciao
31
32 import org.apache.camel.builder.RouteBuilder;
33
34 public class {{ .Name }} extends RouteBuilder {
35 @Override
36 public void configure() throws Exception {
37
38 // Write your routes here, for example:
39 from("timer:java?period=1000")
40 .routeId("java")
41 .setBody()
42 .simple("Hello Camel K from ${routeId}")
43 .to("log:info");
44
45 }
46 }
47 `
48 opts, err := Parse("Example.java", it)
49 require.NoError(t, err)
50 assert.Len(t, opts, 4)
51 assert.Contains(t, opts, Option{Name: "pippo", Value: "pluto"})
52 assert.Contains(t, opts, Option{Name: "paperino"})
53 assert.Contains(t, opts, Option{Name: "ciao", Value: "1"})
54 assert.Contains(t, opts, Option{Name: "ciao"})
55}
56
57func TestParseYAMLFile(t *testing.T) {
58 it := `

Callers

nothing calls this directly

Calls 3

ParseFunction · 0.85
LenMethod · 0.80
ContainsMethod · 0.80

Tested by

no test coverage detected