Package jodd.lagarto

Source Code of jodd.lagarto.SpringApiTest

// Copyright (c) 2003-2014, Jodd Team (jodd.org). All Rights Reserved.

package jodd.lagarto;

import jodd.io.FileUtil;
import jodd.jerry.Jerry;
import jodd.jerry.JerryFunction;
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.net.URL;

import static org.junit.Assert.*;

public class SpringApiTest {

  protected String testDataRoot;

  @Before
  public void setUp() throws Exception {
    if (testDataRoot != null) {
      return;
    }
    URL data = LagartoParserTest.class.getResource("data");
    testDataRoot = data.getFile();
  }

  @Test
  public void testPortletUtils() throws IOException {
    File file = new File(testDataRoot, "PortletUtils.html");
    String content = FileUtil.readString(file);

    Jerry.JerryParser jerryParser = new Jerry.JerryParser();
    //jerryParser.getDOMBuilder().setCalculatePosition(true);

    Jerry doc = jerryParser.parse(content);

    // parse
    doc.$("a").each(new JerryFunction() {
      public boolean onNode(Jerry $this, int index) {
        assertEquals("<a name=\"navbar_top\"><!-- --></a>", $this.get()[0].getHtml());
        return false;
      }
    });
  }

  @Test
  public void testAbstractFormController() throws IOException {
    File file = new File(testDataRoot, "AbstractFormController.html");
    String content = FileUtil.readString(file);

    Jerry.JerryParser jerryParser = new Jerry.JerryParser();
    //jerryParser.getDOMBuilder().setCalculatePosition(true);

    Jerry doc = jerryParser.parse(content);

    // parse
    doc.$("a").each(new JerryFunction() {
      public boolean onNode(Jerry $this, int index) {
        assertEquals("<a name=\"navbar_top\"><!-- --></a>", $this.get()[0].getHtml());
        return false;
      }
    });
  }

}
TOP

Related Classes of jodd.lagarto.SpringApiTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.