package com.miaxis.test;

import com.miaxis.ZzjsApplication;
import com.miaxis.question.domain.QuestionInfo;
import com.miaxis.question.service.IQuestionInfoService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.io.File;
import java.util.List;

@SpringBootTest(classes = ZzjsApplication.class)
@RunWith(SpringRunner.class)
public class NormalTest {

    @Resource
    private IQuestionInfoService questionService;

    @Test
    public void test1() throws Exception {
        QuestionInfo questionInfo = new QuestionInfo();
        questionInfo.setId(17650l);
        List<QuestionInfo> list = questionService.selectQuestionInfoList(questionInfo);

        for (QuestionInfo q: list) {
            System.out.println("--------------------");
            System.out.println(q.getExplain1());
            //调用
            byte2float(q.getExplain1());
            String str = new String(q.getExplain1(), "GBK");
            System.out.println(str);
            String str2 = new String(q.getExplain1(), "UTF-8");
            System.out.println(str2);
            System.out.println("--------------------");
        }




    }

    public float byte2float(byte[] b) {
        if(b!=null) {
            String str = new String(b);
            System.out.println(str);
           // Float f = Float.parseFloat(str);
            return 0;
        } else {
            return 0;
        }
    }





}
