package com.ewei.sdk;

import com.ewei.sdk.constants.PatternValue;

import org.junit.Test;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static org.junit.Assert.*;

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
public class ExampleUnitTest {
    @Test
    public void addition_isCorrect() throws Exception {
        assertEquals(4, 2 + 2);
    }


    @Test
    public void testItemMenu() throws Exception {

//        Pattern r = Pattern.compile(PatternValue.PATTERN_SUBMIT_TICKET);
//        Matcher m = r.matcher("欢迎光临，如需帮助请<save_ticket style=\"color: #6699CC;\">提交工单</save_ticket>。");
//        String replyMessage = "";
//        while (m.find()) {
//            replyMessage = m.group(1).trim();
//        }


        String itemMenu = "【123】产品";

        Pattern r = Pattern.compile(PatternValue.PATTERN_SUBMIT_MENU);
        Matcher m = r.matcher(itemMenu);
        String replyMessage = "";
        while (m.find()) {
            replyMessage = m.group(1).trim();
        }
        System.out.print(replyMessage);
    }

}