@@ -46,61 +46,61 @@ static String jsonFileLocation(String baseDir, String contractName, String input
4646 + ".json" ;
4747 }
4848
49- @ SuppressWarnings ("SameParameterValue" )
50- static Contract parseContractJson (String baseDir , String contractName , String inputFileName )
51- throws Exception {
52-
53- String fileLocation = jsonFileLocation (baseDir , contractName , inputFileName );
54- return loadContractDefinition (new File (fileLocation ));
55- }
56-
57- @ BeforeEach
58- public void setUp () throws Exception {
59- URL url = SolidityFunctionWrapperGeneratorTest .class .getResource ("/truffle" );
60- contractBaseDir = url .getPath ();
61- }
62-
63- @ Test
64- public void testParseMetaCoin () throws Exception {
65- Contract mc = parseContractJson (contractBaseDir , "MetaCoin" , "MetaCoin" );
66-
67- assertEquals ("MetaCoin" , mc .getContractName (), "Unexpected contract name" );
68- }
69-
70- @ Test
71- public void testParseConvertLib () throws Exception {
72- Contract mc = parseContractJson (contractBaseDir , "MetaCoin" , "ConvertLib" );
73-
74- assertEquals ("ConvertLib" , mc .getContractName (), "Unexpected contract name" );
75- assertEquals (1 , mc .abi .size ());
76- AbiDefinition abi = mc .abi .get (0 );
77- assertEquals ("convert" , abi .getName (), "Unexpected function name" );
78- assertTrue (abi .isConstant (), "Expected function to be 'constant" );
79- assertFalse (abi .isPayable (), "Expected function to not be 'payable'" );
80- assertEquals ("function" , abi .getType (), "Expected abi to represent a function" );
81- assertEquals (
82- "pure" ,
83- abi .getStateMutability (),
84- "Expected the 'pure' for the state mutability setting" );
85- }
86-
87- @ Test
88- public void testLinkBinaryWithReferences () throws Exception {
89- Contract mc = parseContractJson (contractBaseDir , "MetaCoin" , "MetaCoin" );
90- assertTrue (mc .getBytecode ().contains ("__ConvertLib____________________________" ));
91-
92- String linked =
93- linkBinaryWithReferences (
94- mc .getBytecode (),
95- Collections .singletonList (
96- new org .web3j .tx .Contract .LinkReference (
97- "./ConvertLib.sol" , "ConvertLib" , Address .DEFAULT )));
98- assertFalse (linked .contains ("__ConvertLib____________________________" ));
99- assertEquals (
100- mc .getBytecode ()
101- .replace (
102- "__ConvertLib____________________________" ,
103- Address .DEFAULT .toString ().substring (2 )),
104- linked );
105- }
49+ // @SuppressWarnings("SameParameterValue")
50+ // static Contract parseContractJson(String baseDir, String contractName, String inputFileName)
51+ // throws Exception {
52+ //
53+ // String fileLocation = jsonFileLocation(baseDir, contractName, inputFileName);
54+ // return loadContractDefinition(new File(fileLocation));
55+ // }
56+ //
57+ // @BeforeEach
58+ // public void setUp() throws Exception {
59+ // URL url = SolidityFunctionWrapperGeneratorTest.class.getResource("/truffle");
60+ // contractBaseDir = url.getPath();
61+ // }
62+ //
63+ // @Test
64+ // public void testParseMetaCoin() throws Exception {
65+ // Contract mc = parseContractJson(contractBaseDir, "MetaCoin", "MetaCoin");
66+ //
67+ // assertEquals("MetaCoin", mc.getContractName(), "Unexpected contract name");
68+ // }
69+ //
70+ // @Test
71+ // public void testParseConvertLib() throws Exception {
72+ // Contract mc = parseContractJson(contractBaseDir, "MetaCoin", "ConvertLib");
73+ //
74+ // assertEquals("ConvertLib", mc.getContractName(), "Unexpected contract name");
75+ // assertEquals(1, mc.abi.size());
76+ // AbiDefinition abi = mc.abi.get(0);
77+ // assertEquals("convert", abi.getName(), "Unexpected function name");
78+ // assertTrue(abi.isConstant(), "Expected function to be 'constant");
79+ // assertFalse(abi.isPayable(), "Expected function to not be 'payable'");
80+ // assertEquals("function", abi.getType(), "Expected abi to represent a function");
81+ // assertEquals(
82+ // "pure",
83+ // abi.getStateMutability(),
84+ // "Expected the 'pure' for the state mutability setting");
85+ // }
86+ //
87+ // @Test
88+ // public void testLinkBinaryWithReferences() throws Exception {
89+ // Contract mc = parseContractJson(contractBaseDir, "MetaCoin", "MetaCoin");
90+ // assertTrue(mc.getBytecode().contains("__ConvertLib____________________________"));
91+ //
92+ // String linked =
93+ // linkBinaryWithReferences(
94+ // mc.getBytecode(),
95+ // Collections.singletonList(
96+ // new org.web3j.tx.Contract.LinkReference(
97+ // "./ConvertLib.sol", "ConvertLib", Address.DEFAULT)));
98+ // assertFalse(linked.contains("__ConvertLib____________________________"));
99+ // assertEquals(
100+ // mc.getBytecode()
101+ // .replace(
102+ // "__ConvertLib____________________________",
103+ // Address.DEFAULT.toString().substring(2)),
104+ // linked);
105+ // }
106106}
0 commit comments