简体   繁体   中英

Could not find matching constructor for: java.util.ArrayList(java.awt.Dimension)

Unable to return ArrayList values to test case

Error : Could not find matching constructor for: java.util.ArrayList(java.awt.Dimension)

My code:

Keyword:

public ArrayList<Integer> othersites() {

        String[] sits = new String[9];
        sits[0] = "https://www.tadawul.com.sa/wps/portal/tadawul/home/";
        sits[1] = "https://www.msm.gov.om/";

        WebUI.navigateToUrl(sits[0]);
        String tdwl = WebUI.getText(findTestObject('ObjectRepository/Sites/site_tdwl'),FailureHandling.CONTINUE_ON_FAILURE)
        String[] parts0 = tdwl.split("\\.")
        String part0 = parts0[0]; // 00
        String part00 = Integer.parseInt(part0.replaceAll(",", ""))
        .
        .

        List<String> list = new ArrayList<String>();
        list.add(part00);
        list.add(part11);

        List<Integer> newList1 = new ArrayList<Integer>(list.size()) ;
        for (String myInt1 : list)
        {
          newList1.add(Integer.valueOf(myInt1));
        }

        return newList1

    }
} 

Customkeyword :

CustomKeywords.'decypha_equities.otherSiteValuesCapture.othersites'()

Expected result :[8566, 3869, 6606, 9806, 2791, 14304, 1529, 1847, 5028]

Actual result : Could not find matching constructor for: java.util.ArrayList(java.awt.Dimension)

Your method return a List not an ArrayList , instead change :

public ArrayList<Integer> othersites() {

to :

import java.util.ArrayList;
import java.util.List;
...
public List<Integer> othersites() {

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM