diff --git a/test/XidynTest.java b/test/XidynTest.java
index e553bd5..d8b89ea 100644
--- a/test/XidynTest.java
+++ b/test/XidynTest.java
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2006-2014 Christian Pierre MOMON
+ * Copyright (C) 2006-2016 Christian Pierre MOMON
*
* This file is part of Xidyn.
*
@@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory;
import fr.devinsy.xidyn.data.SimpleTagData;
import fr.devinsy.xidyn.data.TagDataManager;
-import fr.devinsy.xidyn.presenters.StringPresenter;
+import fr.devinsy.xidyn.presenters.PresenterUtils;
/**
*
@@ -45,7 +45,7 @@ class XidynTest
DECEMBRE
}
- static private Logger logger = LoggerFactory.getLogger(XidynTest.class);
+ private static Logger logger = LoggerFactory.getLogger(XidynTest.class);
static
{
// Initialize logger.
@@ -93,7 +93,7 @@ class XidynTest
datas.setContent("name", "Superman");
try
{
- html = StringPresenter.dynamize("
a name
", datas);
+ html = PresenterUtils.dynamize("a name
", datas);
}
catch (Exception exception)
{
@@ -113,7 +113,7 @@ class XidynTest
try
{
- html = StringPresenter.dynamize("a last name
", datas);
+ html = PresenterUtils.dynamize("a last name
", datas);
}
catch (Exception exception)
{
@@ -134,7 +134,7 @@ class XidynTest
try
{
- html = StringPresenter.dynamize("", datas);
+ html = PresenterUtils.dynamize("", datas);
}
catch (Exception exception)
{
@@ -166,7 +166,7 @@ class XidynTest
htmlSource = source.toString();
try
{
- html = StringPresenter.dynamize(htmlSource, datas);
+ html = PresenterUtils.dynamize(htmlSource, datas);
}
catch (Exception exception)
{
diff --git a/test/fr/devinsy/xidyn/pages/PageFactoryTest.java b/test/fr/devinsy/xidyn/pages/PageFactoryTest.java
new file mode 100644
index 0000000..be6e546
--- /dev/null
+++ b/test/fr/devinsy/xidyn/pages/PageFactoryTest.java
@@ -0,0 +1,70 @@
+/**
+ * Copyright (C) 2016 Christian Pierre MOMON
+ *
+ * This file is part of Xidyn.
+ *
+ * Xidyn is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Xidyn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Xidyn. If not, see
+ */
+package fr.devinsy.xidyn.pages;
+
+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;
+
+/**
+ *
+ */
+public class PageFactoryTest
+{
+ /**
+ *
+ */
+ @Before
+ public void before()
+ {
+ BasicConfigurator.configure();
+ Logger.getRootLogger().setLevel(Level.ERROR);
+ }
+
+ /**
+ * @throws Exception
+ *
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void testPage01() throws Exception
+ {
+ String source = null;
+
+ String target = PageFactory.instance().get(source).dynamize().toString();
+
+ Assertions.assertThat(target).isEqualTo(source);
+ }
+
+ /**
+ * @throws Exception
+ *
+ */
+ @Test
+ public void testPage02() throws Exception
+ {
+ String source = "aaaaahello
zzzzz";
+
+ String target = PageFactory.instance().get(source).dynamize().toString();
+
+ Assertions.assertThat(target).isEqualTo(source);
+ }
+}
diff --git a/test/fr/devinsy/xidyn/pages/PageTest.java b/test/fr/devinsy/xidyn/pages/PageTest.java
index 183d441..9ee406a 100644
--- a/test/fr/devinsy/xidyn/pages/PageTest.java
+++ b/test/fr/devinsy/xidyn/pages/PageTest.java
@@ -25,8 +25,6 @@ import org.fest.assertions.Assertions;
import org.junit.Before;
import org.junit.Test;
-import fr.devinsy.xidyn.data.TagDataManager;
-import fr.devinsy.xidyn.presenters.PresenterUtils;
import fr.devinsy.xidyn.presenters.StringPresenter;
/**
@@ -49,89 +47,12 @@ public class PageTest
*
*/
@Test
- public void testDynamize01() throws Exception
+ public void testPage01() throws Exception
{
- String source = "aaaaahellozzzzz";
+ String source = "aaaaahello
zzzzz";
String target = new Page(new StringPresenter(source)).dynamize().toString();
Assertions.assertThat(target).isEqualTo(source);
-
- target = new Page(new StringPresenter(source)).lastVersion().toString();
-
- Assertions.assertThat(target).isEqualTo(source);
}
-
- /**
- * @throws Exception
- *
- */
- @Test
- public void testDynamize02() throws Exception
- {
- String source = "aaaaahellozzzzz";
-
- String target = new StringPresenter(source).dynamize(null).toString();
-
- Assertions.assertThat(target).isEqualTo(source);
- }
-
- /**
- * @throws Exception
- *
- */
- @Test
- public void testDynamize03() throws Exception
- {
- String source = "aaaaahello
zzzzz";
-
- String target = new StringPresenter(source).dynamize(new TagDataManager()).toString();
-
- Assertions.assertThat(target).isEqualTo(source);
- }
-
- /**
- * @throws Exception
- *
- */
- @Test
- public void testPage02() throws Exception
- {
- String source = "aaaaahello
zzzzz";
-
- Page page = PageFactory.instance().get(source);
-
- String target = page.dynamize().toString();
-
- Assertions.assertThat(target).isEqualTo(source);
- }
-
- /**
- * @throws Exception
- *
- */
- @Test
- public void testStaticDynamize01() throws Exception
- {
- String source = "aaaaahello
zzzzz";
-
- String target = PresenterUtils.dynamize(source, null).toString();
-
- Assertions.assertThat(target).isEqualTo(source);
- }
-
- /**
- * @throws Exception
- *
- */
- @Test
- public void testStaticDynamize02() throws Exception
- {
- String source = "aaaaahello
zzzzz";
-
- String target = PresenterUtils.dynamize(source, new TagDataManager()).toString();
-
- Assertions.assertThat(target).isEqualTo(source);
- }
-
}
diff --git a/test/fr/devinsy/xidyn/presenters/StringPresenterTest.java b/test/fr/devinsy/xidyn/presenters/StringPresenterTest.java
index cde3b97..521c827 100644
--- a/test/fr/devinsy/xidyn/presenters/StringPresenterTest.java
+++ b/test/fr/devinsy/xidyn/presenters/StringPresenterTest.java
@@ -49,7 +49,7 @@ public class StringPresenterTest
@Test
public void testDynamize01() throws Exception
{
- String source = "aaaaahellozzzzz";
+ String source = "aaaaahello
zzzzz";
String target = new StringPresenter(source).dynamize().toString();
@@ -63,7 +63,7 @@ public class StringPresenterTest
@Test
public void testDynamize02() throws Exception
{
- String source = "aaaaahellozzzzz";
+ String source = "aaaaahello
zzzzz";
String target = new StringPresenter(source).dynamize(null).toString();