Add tests.

This commit is contained in:
Christian P. MOMON 2013-08-03 04:36:13 +02:00
parent 5617603b29
commit 15dc84bfc9
2 changed files with 194 additions and 0 deletions

View file

@ -0,0 +1,97 @@
package fr.devinsy.xidyn.presenters;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.fest.assertions.Assertions;
import org.junit.Before;
import org.junit.Test;
import fr.devinsy.xidyn.data.TagDataManager;
/**
*
*/
public class DomPresenterTest
{
/**
*
*/
@Before
public void before()
{
BasicConfigurator.configure();
Logger.getRootLogger().setLevel(Level.ERROR);
}
/**
* @throws Exception
*
*/
@Test
public void testDynamize01() throws Exception
{
String source = "aaaaa<body>hello</body>zzzzz";
String target = new StringPresenter(source).dynamize().toString();
Assertions.assertThat(target).isEqualTo(source);
}
/**
* @throws Exception
*
*/
@Test
public void testDynamize02() throws Exception
{
String source = "aaaaa<body>hello</body>zzzzz";
String target = new StringPresenter(source).dynamize(null).toString();
Assertions.assertThat(target).isEqualTo(source);
}
/**
* @throws Exception
*
*/
@Test
public void testDynamize03() throws Exception
{
String source = "aaaaa<body>hello</body>zzzzz";
String target = new StringPresenter(source).dynamize(new TagDataManager()).toString();
Assertions.assertThat(target).isEqualTo(source);
}
/**
* @throws Exception
*
*/
@Test
public void testStaticDynamize01() throws Exception
{
String source = "aaaaa<body>hello</body>zzzzz";
String target = StringPresenter.dynamize(source, null).toString();
Assertions.assertThat(target).isEqualTo(source);
}
/**
* @throws Exception
*
*/
@Test
public void testStaticDynamize02() throws Exception
{
String source = "aaaaa<body>hello</body>zzzzz";
String target = StringPresenter.dynamize(source, new TagDataManager()).toString();
Assertions.assertThat(target).isEqualTo(source);
}
}

View file

@ -0,0 +1,97 @@
package fr.devinsy.xidyn.presenters;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.fest.assertions.Assertions;
import org.junit.Before;
import org.junit.Test;
import fr.devinsy.xidyn.data.TagDataManager;
/**
*
*/
public class StringPresenterTest
{
/**
*
*/
@Before
public void before()
{
BasicConfigurator.configure();
Logger.getRootLogger().setLevel(Level.ERROR);
}
/**
* @throws Exception
*
*/
@Test
public void testDynamize01() throws Exception
{
String source = "aaaaa<body>hello</body>zzzzz";
String target = new StringPresenter(source).dynamize().toString();
Assertions.assertThat(target).isEqualTo(source);
}
/**
* @throws Exception
*
*/
@Test
public void testDynamize02() throws Exception
{
String source = "aaaaa<body>hello</body>zzzzz";
String target = new StringPresenter(source).dynamize(null).toString();
Assertions.assertThat(target).isEqualTo(source);
}
/**
* @throws Exception
*
*/
@Test
public void testDynamize03() throws Exception
{
String source = "aaaaa<body>hello</body>zzzzz";
String target = new StringPresenter(source).dynamize(new TagDataManager()).toString();
Assertions.assertThat(target).isEqualTo(source);
}
/**
* @throws Exception
*
*/
@Test
public void testStaticDynamize01() throws Exception
{
String source = "aaaaa<body>hello</body>zzzzz";
String target = StringPresenter.dynamize(source, null).toString();
Assertions.assertThat(target).isEqualTo(source);
}
/**
* @throws Exception
*
*/
@Test
public void testStaticDynamize02() throws Exception
{
String source = "aaaaa<body>hello</body>zzzzz";
String target = StringPresenter.dynamize(source, new TagDataManager()).toString();
Assertions.assertThat(target).isEqualTo(source);
}
}