Refactor formatter.

This commit is contained in:
Christian P. MOMON 2016-09-08 02:41:48 +02:00
parent 3b2de97563
commit faabbe42be
38 changed files with 4883 additions and 4620 deletions

View file

@ -1,4 +1,14 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
org.eclipse.jdt.core.codeComplete.fieldPrefixes=
org.eclipse.jdt.core.codeComplete.fieldSuffixes=
org.eclipse.jdt.core.codeComplete.localPrefixes=
org.eclipse.jdt.core.codeComplete.localSuffixes=
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
@ -21,7 +31,7 @@ org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
@ -60,7 +70,7 @@ org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_block_comments=false
org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
@ -85,12 +95,12 @@ org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_de
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=false
org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
@ -287,7 +297,7 @@ org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false

View file

@ -1,3 +1,113 @@
cleanup.add_default_serial_version_id=false
cleanup.add_generated_serial_version_id=true
cleanup.add_missing_annotations=true
cleanup.add_missing_deprecated_annotations=true
cleanup.add_missing_methods=false
cleanup.add_missing_nls_tags=false
cleanup.add_missing_override_annotations=true
cleanup.add_missing_override_annotations_interface_methods=true
cleanup.add_serial_version_id=true
cleanup.always_use_blocks=true
cleanup.always_use_parentheses_in_expressions=false
cleanup.always_use_this_for_non_static_field_access=true
cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_to_enhanced_for_loop=false
cleanup.correct_indentation=false
cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false
cleanup.make_local_variable_final=false
cleanup.make_parameters_final=true
cleanup.make_private_fields_final=false
cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=true
cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=true
cleanup.organize_imports=false
cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.remove_private_constructors=true
cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false
cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true
cleanup.remove_unused_local_variables=false
cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true
cleanup.sort_members=true
cleanup.sort_members_all=false
cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_parentheses_in_expressions=false
cleanup.use_this_for_non_static_field_access=true
cleanup.use_this_for_non_static_field_access_only_if_necessary=false
cleanup.use_this_for_non_static_method_access=false
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup_profile=_Xidyn
cleanup_settings_version=2
eclipse.preferences.version=1 eclipse.preferences.version=1
formatter_profile=_Devinsy editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Xidyn
formatter_settings_version=12 formatter_settings_version=12
org.eclipse.jdt.ui.exception.name=exception
org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.keywordthis=false
org.eclipse.jdt.ui.overrideannotation=true
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
sp_cleanup.add_missing_override_annotations=true
sp_cleanup.add_missing_override_annotations_interface_methods=true
sp_cleanup.add_serial_version_id=false
sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=true
sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=true
sp_cleanup.format_source_code=true
sp_cleanup.format_source_code_changes_only=false
sp_cleanup.make_local_variable_final=false
sp_cleanup.make_parameters_final=true
sp_cleanup.make_private_fields_final=false
sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=true
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_trailing_whitespaces=false
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
sp_cleanup.remove_unnecessary_casts=true
sp_cleanup.remove_unnecessary_nls_tags=true
sp_cleanup.remove_unused_imports=true
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=true
sp_cleanup.sort_members_all=false
sp_cleanup.use_blocks=true
sp_cleanup.use_blocks_only_for_return_and_throw=false
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=true
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *
@ -22,14 +22,14 @@ import org.slf4j.LoggerFactory;
import fr.devinsy.xidyn.data.SimpleTagData; import fr.devinsy.xidyn.data.SimpleTagData;
import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.StringPresenter; import fr.devinsy.xidyn.presenters.PresenterUtils;
/** /**
* *
*/ */
class XidynDemo class XidynDemo
{ {
static private Logger logger = LoggerFactory.getLogger(XidynDemo.class); private static Logger logger = LoggerFactory.getLogger(XidynDemo.class);
static static
{ {
// Initialize logger. // Initialize logger.
@ -61,7 +61,7 @@ class XidynDemo
StringBuffer htmlTarget; StringBuffer htmlTarget;
try try
{ {
htmlTarget = StringPresenter.dynamize(htmlSource, data); htmlTarget = PresenterUtils.dynamize(htmlSource, data);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -91,7 +91,7 @@ class XidynDemo
StringBuffer htmlTarget; StringBuffer htmlTarget;
try try
{ {
htmlTarget = StringPresenter.dynamize(htmlSource, data); htmlTarget = PresenterUtils.dynamize(htmlSource, data);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -127,7 +127,7 @@ class XidynDemo
StringBuffer htmlTarget; StringBuffer htmlTarget;
try try
{ {
htmlTarget = StringPresenter.dynamize(htmlSource, data); htmlTarget = PresenterUtils.dynamize(htmlSource, data);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -172,7 +172,7 @@ class XidynDemo
StringBuffer htmlTarget; StringBuffer htmlTarget;
try try
{ {
htmlTarget = StringPresenter.dynamize(htmlSource, data); htmlTarget = PresenterUtils.dynamize(htmlSource, data);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -241,7 +241,7 @@ class XidynDemo
StringBuffer html; StringBuffer html;
try try
{ {
html = StringPresenter.dynamize(htmlSource, data); html = PresenterUtils.dynamize(htmlSource, data);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -256,7 +256,7 @@ class XidynDemo
System.out.println("ONLY_FIRST_TWO_ROWS:"); System.out.println("ONLY_FIRST_TWO_ROWS:");
try try
{ {
html = StringPresenter.dynamize(htmlSource, data); html = PresenterUtils.dynamize(htmlSource, data);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -271,7 +271,7 @@ class XidynDemo
System.out.println("ONLY_ROWS_WITH_ID:"); System.out.println("ONLY_ROWS_WITH_ID:");
try try
{ {
html = StringPresenter.dynamize(htmlSource, data); html = PresenterUtils.dynamize(htmlSource, data);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -286,7 +286,7 @@ class XidynDemo
System.out.println("ONLY_ROWS_WITHOUT_ID:"); System.out.println("ONLY_ROWS_WITHOUT_ID:");
try try
{ {
html = StringPresenter.dynamize(htmlSource, data); html = PresenterUtils.dynamize(htmlSource, data);
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -301,7 +301,7 @@ class XidynDemo
System.out.println("ALL_ROWS:"); System.out.println("ALL_ROWS:");
try try
{ {
html = StringPresenter.dynamize(htmlSource, data); html = PresenterUtils.dynamize(htmlSource, data);
} }
catch (Exception exception) catch (Exception exception)
{ {

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *
@ -36,12 +36,18 @@ public class SimpleTagData implements Serializable, TagData
{ {
public enum IterationStrategy public enum IterationStrategy
{ {
ONLY_FIRST_ROW, ONLY_FIRST_TWO_ROWS, ONLY_ROWS_WITH_ID, ONLY_ROWS_WITHOUT_ID, ALL_ROWS ONLY_FIRST_ROW,
ONLY_FIRST_TWO_ROWS,
ONLY_ROWS_WITH_ID,
ONLY_ROWS_WITHOUT_ID,
ALL_ROWS
} }
public enum MODE public enum MODE
{ {
REPLACE, APPEND, IGNORE REPLACE,
APPEND,
IGNORE
} }
private static final long serialVersionUID = 8976245034682639923L;; private static final long serialVersionUID = 8976245034682639923L;;

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *

View file

@ -53,6 +53,15 @@ public class PageFactory
this.cache = new Cache<Page>(); this.cache = new Cache<Page>();
} }
/**
*
*/
public void clear()
{
this.cache.clear();
PresenterFactory.instance().clear();
}
/** /**
* *
* @param source * @param source
@ -210,15 +219,6 @@ public class PageFactory
return result; return result;
} }
/**
*
*/
public void clear()
{
this.cache.clear();
PresenterFactory.instance().clear();
}
/** /**
* *
* @return * @return

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *

View file

@ -31,7 +31,18 @@ class XidynTest
{ {
public enum MONTHS public enum MONTHS
{ {
JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBRE, DECEMBRE JANUARY,
FEBRUARY,
MARCH,
APRIL,
MAY,
JUNE,
JULY,
AUGUST,
SEPTEMBER,
OCTOBER,
NOVEMBRE,
DECEMBRE
} }
static private Logger logger = LoggerFactory.getLogger(XidynTest.class); static private Logger logger = LoggerFactory.getLogger(XidynTest.class);

View file

@ -0,0 +1,137 @@
/**
* 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 <http://www.gnu.org/licenses/>
*/
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;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
import fr.devinsy.xidyn.presenters.StringPresenter;
/**
*
*/
public class PageTest
{
/**
*
*/
@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 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 = "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<div>hello</div>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 = "aaaaa<div>hello</div>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 = "aaaaa<div>hello</div>zzzzz";
String target = PresenterUtils.dynamize(source, null).toString();
Assertions.assertThat(target).isEqualTo(source);
}
/**
* @throws Exception
*
*/
@Test
public void testStaticDynamize02() throws Exception
{
String source = "aaaaa<div>hello</div>zzzzz";
String target = PresenterUtils.dynamize(source, new TagDataManager()).toString();
Assertions.assertThat(target).isEqualTo(source);
}
}

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *
@ -18,11 +18,7 @@
*/ */
package fr.devinsy.xidyn.presenters; 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.fest.assertions.Assertions;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.data.TagDataManager;
@ -32,57 +28,6 @@ import fr.devinsy.xidyn.data.TagDataManager;
*/ */
public class DomPresenterTest 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<div>hello</div>zzzzz";
String target = new StringPresenter(source).dynamize().toString();
Assertions.assertThat(target).isEqualTo(source);
}
/**
* @throws Exception
*
*/
@Test
public void testDynamize02() throws Exception
{
String source = "aaaaa<div>hello</div>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<div>hello</div>zzzzz";
String target = new StringPresenter(source).dynamize(new TagDataManager()).toString();
Assertions.assertThat(target).isEqualTo(source);
}
/** /**
* @throws Exception * @throws Exception
@ -93,7 +38,7 @@ public class DomPresenterTest
{ {
String source = "aaaaa<div>hello</div>zzzzz"; String source = "aaaaa<div>hello</div>zzzzz";
String target = StringPresenter.dynamize(source, null).toString(); String target = PresenterUtils.dynamize(source, null).toString();
Assertions.assertThat(target).isEqualTo(source); Assertions.assertThat(target).isEqualTo(source);
} }
@ -107,7 +52,7 @@ public class DomPresenterTest
{ {
String source = "aaaaa<div>hello</div>zzzzz"; String source = "aaaaa<div>hello</div>zzzzz";
String target = StringPresenter.dynamize(source, new TagDataManager()).toString(); String target = PresenterUtils.dynamize(source, new TagDataManager()).toString();
Assertions.assertThat(target).isEqualTo(source); Assertions.assertThat(target).isEqualTo(source);
} }

View file

@ -0,0 +1,73 @@
/**
* Copyright (C) 2006-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 <http://www.gnu.org/licenses/>
*/
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 PresenterUtilsTest
{
/**
*
*/
@Before
public void before()
{
BasicConfigurator.configure();
Logger.getRootLogger().setLevel(Level.ERROR);
}
/**
* @throws Exception
*
*/
@Test
public void testStaticDynamize01() throws Exception
{
String source = "aaaaa<div>hello</div>zzzzz";
String target = PresenterUtils.dynamize(source, null).toString();
Assertions.assertThat(target).isEqualTo(source);
}
/**
* @throws Exception
*
*/
@Test
public void testStaticDynamize02() throws Exception
{
String source = "aaaaa<div>hello</div>zzzzz";
String target = PresenterUtils.dynamize(source, new TagDataManager()).toString();
Assertions.assertThat(target).isEqualTo(source);
}
}

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *
@ -83,33 +83,4 @@ public class StringPresenterTest
Assertions.assertThat(target).isEqualTo(source); Assertions.assertThat(target).isEqualTo(source);
} }
/**
* @throws Exception
*
*/
@Test
public void testStaticDynamize01() throws Exception
{
String source = "aaaaa<div>hello</div>zzzzz";
String target = StringPresenter.dynamize(source, null).toString();
Assertions.assertThat(target).isEqualTo(source);
}
/**
* @throws Exception
*
*/
@Test
public void testStaticDynamize02() throws Exception
{
String source = "aaaaa<div>hello</div>zzzzz";
String target = StringPresenter.dynamize(source, new TagDataManager()).toString();
Assertions.assertThat(target).isEqualTo(source);
}
} }

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2006-2014 Christian Pierre MOMON * Copyright (C) 2006-2016 Christian Pierre MOMON
* *
* This file is part of Xidyn. * This file is part of Xidyn.
* *