package test;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

public class testng1 {

	@DataProvider(name = "user")
	public Object[][] createUser(Method m) {
		System.out.println(m.getName());
		return new Object[][] { { "root", "root" }, { "test", "root" }, };
	}

	@Test(groups = "login", dependsOnGroups = "launch", dataProvider = "user")
	public void verifyUser(String username, String password) {
		System.out.println("Verify User : " + username + ":" + password);
		assert username.equals(password);
	}
	
	public static void main(String[] args) {
		Map<String, String> hashMap = new HashMap<String, String>();
        
        hashMap.put("cn","中国");
         
        hashMap.put("us","米国");
         
        hashMap.put("en","英国");
        System.out.println(hashMap);
        /**
         * Map 集合没有方法转成字符串，
         * 可以按照自己的方法将其拼接成字符串
         * 1、遍历map集合
         */
        String str = "";//用于存放遍历出来的字符串
        Iterator  iterator = hashMap.keySet().iterator();
        while (iterator.hasNext()) {
            //2、拼接字符串
            str += hashMap.get(iterator.next()).toString()+",";
        }
        System.out.println(str);
	}
}
