java - Calling HashMap data from a separate class/method -
my question revolves around how call hashmap data have stored in method main junit testing class.
@test public void pcitest() throws exception { hashmap<string, string> examples = new hashmap<string, string>(); examples.put(pcitestdata()); //remaining testing code below } //storing data here public hashmap<string,string> pcitestdata() { hashmap<string, string> examples = new hashmap<string, string>(); public static hashmap<string, string> getexamples() { return examples; } examples.put("credit card", "4929028573388403\n" + "4024007140713941\n" + "4528684534391095\n" + "5188872375900391\n" + "5449835900541183\n" + "5525878422452056\n"); //more data below }
i want take data pcitestdata() , place in hashmap examples in pcitest(), seen examples.put(pcitestdata()) portion.
the getexamples() method kind of placeholder testing various methods, not sure if needed or not.
i've tried pcitestdata().get.keyset() returning error.
what trying achieve ?
for understand, guess want copy result map returned pcitestdata()
method in test variable examples
?
if want copy content of map, use map#putall((map<? extends k,? extends v> m)
:
examples.putall(pcitestdata());
if wanted access method result method (here, test method), need instantiate variable, other 1 :
examples = pcitestdata();
Comments
Post a Comment