package com.lovejjfg.family;

import com.lovejjfg.blogdemo.utils.BaseUtil;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

@RunWith(RobolectricTestRunner.class)
@Config(sdk = 23, manifest = Config.NONE)
public class ApiTest extends BaseTest {



    //    private LoginApi loginApi;
    @Override
    @Before
    public void setUp() {
        super.setUp();
//        activity = Robolectric.buildActivity(MainActivity.class).create().get();
//        userService = BaseDataManager.getUserService();
//        loginApi = BaseDataManager.getLoginApi();
    }

    @After
    public void tearDown() {

    }


    @Test
    public void testVersion() throws Exception {
        int versionCode = BaseUtil.getVersionCode(context);
        String versionName = BaseUtil.getVersionName(context);
        System.out.println(versionCode);
        System.out.println(versionName);

    }


}

@@ -69,16 +69,139 @@
 eUtil;%0A%0A
+import org.jsoup.Jsoup;%0Aimport org.jsoup.nodes.Document;%0Aimport org.jsoup.nodes.Element;%0Aimport org.jsoup.select.Elements;%0A
 import o
@@ -212,24 +212,24 @@
 unit.After;%0A
-
 import org.j
@@ -386,16 +386,45 @@
 onfig;%0A%0A
+import java.io.IOException;%0A%0A
 @RunWith
@@ -537,17 +537,16 @@
 est %7B%0A%0A%0A
-%0A
     //  
@@ -1170,11 +1170,1914 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void testJsoup() throws IOException %7B%0A        Document document = Jsoup.connect(%22https://android-arsenal.com/user/lovejjfg%22).get();%0A        Elements select = document.select(%22div.container.content%22);%0A        for (Element element : select) %7B%0A            String tittle = element.select(%22a%5Bhref%5D%22).first().text();%0A            System.out.println(%22name: %22 + tittle);%0A            String url = element.select(%22a%22).first().attr(%22href%22);%0A            System.out.println(%22url: %22 + url);%0A            String attr = element.select(%22img%22).attr(%22src%22);%0A            System.out.println(%22%E5%A4%B4%E5%83%8F: %22 + attr);%0A%0A            String email = element.select(%22a.email%22).text();%0A            System.out.println(%22email: %22 + email);%0A            String urls = element.select(%22a.url%22).text();%0A            System.out.println(%22urls: %22 + urls);%0A%0A            String location = element.select(%22dt:contains(Location) + dd%22).first().text();%0A            System.out.println(%22call: %22 + location);%0A            element.select(%22div.moduletable_events %3E ul%22);%0A            Elements h2Tags = element.select(%22h2%22);%0A            for (Element e : h2Tags) %7B%0A                System.out.println(%22call: %22 + e.toString());%0A//                            Elements ul = e.select(%22div.moduletable_events %3E ul%22);%0A                Elements li = e.select(%22li%22);%0A                for (Element l : li) %7B%0A                    System.out.println(%22call: %22 + l.toString());%0A                %7D%0A%0A            %7D%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void testJsoup2() throws IOException %7B%0A        Document document = Jsoup.connect(%22https://android-arsenal.com/user/lovejjfg%22).get();%0A//        Elements select = document.select(%22div.container.content%22);%0A        Elements select = document.select(%22div.container.content%22)%0A                .select(%22ul%3E li%22);%0A%0A        for (Element element : select) %7B%0A            System.out.println(element.toString());%0A        %7D%0A    %7D%0A%0A
 %0A%7D%0A

add new jsoup test