diff --git a/libraries-2/src/test/java/com/baeldung/handlebars/BuiltinHelperUnitTest.java b/libraries-2/src/test/java/com/baeldung/handlebars/BuiltinHelperUnitTest.java index aa29e4c441..357bb7df89 100644 --- a/libraries-2/src/test/java/com/baeldung/handlebars/BuiltinHelperUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/handlebars/BuiltinHelperUnitTest.java @@ -1,15 +1,14 @@ package com.baeldung.handlebars; -import static org.assertj.core.api.Assertions.assertThat; - import com.github.jknack.handlebars.Handlebars; import com.github.jknack.handlebars.Template; import com.github.jknack.handlebars.io.ClassPathTemplateLoader; import com.github.jknack.handlebars.io.TemplateLoader; +import org.junit.Test; + import java.io.IOException; -import org.junit.Ignore; -import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; /** * Showcases the built-in template helpers. @@ -20,7 +19,6 @@ public class BuiltinHelperUnitTest { private TemplateLoader templateLoader = new ClassPathTemplateLoader("/handlebars", ".html"); - @Ignore @Test public void whenUsedWith_ThenContextChanges() throws IOException { Handlebars handlebars = new Handlebars(templateLoader); @@ -30,10 +28,9 @@ public class BuiltinHelperUnitTest { String templateString = template.apply(person); - assertThat(templateString).isEqualTo("\n

I live in World

\n"); + assertThat(templateString).contains("

I live in World

"); } - @Ignore @Test public void whenUsedWithMustacheStyle_ThenContextChanges() throws IOException { Handlebars handlebars = new Handlebars(templateLoader); @@ -43,10 +40,9 @@ public class BuiltinHelperUnitTest { String templateString = template.apply(person); - assertThat(templateString).isEqualTo("\n

I live in World

\n"); + assertThat(templateString).contains("

I live in World

"); } - @Ignore @Test public void whenUsedEach_ThenIterates() throws IOException { Handlebars handlebars = new Handlebars(templateLoader); @@ -59,11 +55,10 @@ public class BuiltinHelperUnitTest { String templateString = template.apply(person); - assertThat(templateString).isEqualTo("\nJava is my friend.\n" - + "\nSpring is my friend.\n"); + assertThat(templateString) + .contains("Java is my friend.", "Spring is my friend."); } - @Ignore @Test public void whenUsedEachMustacheStyle_ThenIterates() throws IOException { Handlebars handlebars = new Handlebars(templateLoader); @@ -76,11 +71,10 @@ public class BuiltinHelperUnitTest { String templateString = template.apply(person); - assertThat(templateString).isEqualTo("\nJava is my friend.\n" - + "\nSpring is my friend.\n"); + assertThat(templateString) + .contains("Java is my friend.", "Spring is my friend."); } - @Ignore @Test public void whenUsedIf_ThenPutsCondition() throws IOException { Handlebars handlebars = new Handlebars(templateLoader); @@ -90,10 +84,9 @@ public class BuiltinHelperUnitTest { String templateString = template.apply(person); - assertThat(templateString).isEqualTo("\n

Baeldung is busy.

\n"); + assertThat(templateString).contains("

Baeldung is busy.

"); } - @Ignore @Test public void whenUsedIfMustacheStyle_ThenPutsCondition() throws IOException { Handlebars handlebars = new Handlebars(templateLoader); @@ -103,7 +96,7 @@ public class BuiltinHelperUnitTest { String templateString = template.apply(person); - assertThat(templateString).isEqualTo("\n

Baeldung is busy.

\n"); + assertThat(templateString).contains("

Baeldung is busy.

"); } private Person getPerson(String name) { diff --git a/libraries-2/src/test/java/com/baeldung/handlebars/ReusingTemplatesUnitTest.java b/libraries-2/src/test/java/com/baeldung/handlebars/ReusingTemplatesUnitTest.java index 56449f59e4..376e44e4bd 100644 --- a/libraries-2/src/test/java/com/baeldung/handlebars/ReusingTemplatesUnitTest.java +++ b/libraries-2/src/test/java/com/baeldung/handlebars/ReusingTemplatesUnitTest.java @@ -1,15 +1,14 @@ package com.baeldung.handlebars; -import static org.assertj.core.api.Assertions.assertThat; - import com.github.jknack.handlebars.Handlebars; import com.github.jknack.handlebars.Template; import com.github.jknack.handlebars.io.ClassPathTemplateLoader; import com.github.jknack.handlebars.io.TemplateLoader; +import org.junit.Test; + import java.io.IOException; -import org.junit.Ignore; -import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; /** * Showcases reusing the existing templates. @@ -20,7 +19,6 @@ public class ReusingTemplatesUnitTest { private TemplateLoader templateLoader = new ClassPathTemplateLoader("/handlebars", ".html"); - @Ignore @Test public void whenOtherTemplateIsReferenced_ThenCanReuse() throws IOException { Handlebars handlebars = new Handlebars(templateLoader); @@ -30,10 +28,10 @@ public class ReusingTemplatesUnitTest { String templateString = template.apply(person); - assertThat(templateString).isEqualTo("

Hi Baeldung!

\n

This is the page Baeldung

"); + assertThat(templateString) + .contains("

Hi Baeldung!

", "

This is the page Baeldung

"); } - @Ignore @Test public void whenBlockIsDefined_ThenCanOverrideWithPartial() throws IOException { Handlebars handlebars = new Handlebars(templateLoader); @@ -43,11 +41,11 @@ public class ReusingTemplatesUnitTest { String templateString = template.apply(person); - assertThat(templateString).isEqualTo("\n\n" - + "\n" - + "\n This is the intro\n\n" - + "\n Hi there!\n\n" - + "\n" - + ""); + assertThat(templateString).contains("", + "", + "This is the intro", + "Hi there!", + "", + ""); } }