MCPcopy Create free account
hub / github.com/google/gapid / TestInvokeStaticMethod

Function TestInvokeStaticMethod

core/java/jdwp/jdwp_test.go:84–111  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

82}
83
84func TestInvokeStaticMethod(t *testing.T) {
85 ctx := log.Testing(t)
86
87 class, err := connection.GetClassBySignature("LCalculator;")
88 if err != nil {
89 log.F(ctx, true, "GetClassesBySignature returned error: %v", err)
90 return
91 }
92
93 methods, err := connection.GetMethods(class.TypeID)
94 if err != nil {
95 log.F(ctx, true, "GetMethods returned error: %v", err)
96 return
97 }
98
99 add := methods.FindBySignature("Add", "(II)I")
100 if add == nil {
101 log.F(ctx, true, "Couldn't find method Add: %v", err)
102 return
103 }
104
105 result, err := connection.InvokeStaticMethod(class.ClassID(), add.ID, thread, jdwp.InvokeSingleThreaded, 3, 7)
106 if err != nil {
107 log.F(ctx, true, "InvokeStaticMethod returned error: %v", err)
108 return
109 }
110 assert.For(ctx, "Add(3, 7)").That(result.Result).Equals(10)
111}
112
113func TestInvokeMethod(t *testing.T) {
114 ctx := log.Testing(t)

Callers

nothing calls this directly

Calls 9

GetClassBySignatureMethod · 0.80
FMethod · 0.80
GetMethodsMethod · 0.80
InvokeStaticMethodMethod · 0.80
ClassIDMethod · 0.80
ThatMethod · 0.80
ForMethod · 0.80
EqualsMethod · 0.65
FindBySignatureMethod · 0.45

Tested by

no test coverage detected