File tree Expand file tree Collapse file tree 3 files changed +46
-5
lines changed
main/java/org/web3j/codegen/unit/gen
test/java/org/web3j/codegen/unit/gen Expand file tree Collapse file tree 3 files changed +46
-5
lines changed Original file line number Diff line number Diff line change @@ -61,9 +61,11 @@ public static List<MethodSpec> generateMethodSpecsForEachTest(Class theContract)
61
61
.forEach (
62
62
method -> {
63
63
String uniqueName = getUniqueName (method , methodNameCountMap );
64
- listOfMethodSpecs .add (
65
- new MethodParser (method , theContract , uniqueName )
66
- .getMethodSpec ());
64
+ if (!uniqueName .startsWith ("getDeploymentBinary" )) {
65
+ listOfMethodSpecs .add (
66
+ new MethodParser (method , theContract , uniqueName )
67
+ .getMethodSpec ());
68
+ }
67
69
});
68
70
69
71
return listOfMethodSpecs ;
@@ -76,8 +78,11 @@ public static List<FunSpec> generateFunctionSpecsForEachTest(Class theContract)
76
78
.forEach (
77
79
method -> {
78
80
String uniqueName = getUniqueName (method , functionNameCountMap );
79
- listOfFunSpecs .add (
80
- new FunParser (method , theContract , uniqueName ).getFunSpec ());
81
+ if (!uniqueName .startsWith ("getDeploymentBinary" )) {
82
+ listOfFunSpecs .add (
83
+ new FunParser (method , theContract , uniqueName )
84
+ .getFunSpec ());
85
+ }
81
86
});
82
87
83
88
return listOfFunSpecs ;
Original file line number Diff line number Diff line change @@ -73,4 +73,22 @@ public void testGeneratedDuplicateGreetingMethods() {
73
73
greetMethodSpecs .stream ().anyMatch (methodSpec -> methodSpec .name .equals ("greet1" )));
74
74
assertEquals (2 , greetMethodSpecs .size ());
75
75
}
76
+
77
+ @ Test
78
+ public void testGetDeploymentBinaryMethodNotGenerated () {
79
+ List <MethodSpec > allMethodSpecs =
80
+ MethodFilter .generateMethodSpecsForEachTest (greeterContractClass );
81
+
82
+ // Filter all MethodSpecs for those related to "getDeploymentBinary" method
83
+ List <MethodSpec > getDeploymentBinaryMethodSpecs =
84
+ allMethodSpecs .stream ()
85
+ .filter (methodSpec -> methodSpec .name .startsWith ("getDeploymentBinary" ))
86
+ .collect (Collectors .toList ());
87
+
88
+ // Ensure no MethodSpecs were generated for getDeploymentBinary method
89
+ assertEquals (
90
+ 0 ,
91
+ getDeploymentBinaryMethodSpecs .size (),
92
+ "MethodSpec list should not contain getDeploymentBinary method" );
93
+ }
76
94
}
Original file line number Diff line number Diff line change @@ -78,4 +78,22 @@ public void testGeneratedDuplicateGreetingMethods() {
78
78
.anyMatch (methodSpec -> methodSpec .getName ().equals ("greet1" )));
79
79
assertEquals (2 , greetFunSpecs .size ());
80
80
}
81
+
82
+ @ Test
83
+ public void testGetDeploymentBinaryMethodNotGenerated () {
84
+ List <FunSpec > allMethodSpecs =
85
+ MethodFilter .generateFunctionSpecsForEachTest (greeterContractClass );
86
+
87
+ // Filter all FunSpecs for those related to "getDeploymentBinary" method
88
+ List <FunSpec > getDeploymentBinaryFunSpecs =
89
+ allMethodSpecs .stream ()
90
+ .filter (funSpec -> funSpec .getName ().startsWith ("getDeploymentBinary" ))
91
+ .collect (Collectors .toList ());
92
+
93
+ // Ensure no MethodSpecs were generated for getDeploymentBinary method
94
+ assertEquals (
95
+ 0 ,
96
+ getDeploymentBinaryFunSpecs .size (),
97
+ "MethodSpec list should not contain getDeploymentBinary function" );
98
+ }
81
99
}
You can’t perform that action at this time.
0 commit comments