BAEL-2981: Changed helper name

This commit is contained in:
isaolmez 2019-06-22 11:18:41 +03:00
parent e9410f8fda
commit ca3ef57f04
3 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@ public class CustomHelperUnitTest {
@Test @Test
public void whenHelperIsCreated_ThenCanRegister() throws IOException { public void whenHelperIsCreated_ThenCanRegister() throws IOException {
Handlebars handlebars = new Handlebars(templateLoader); Handlebars handlebars = new Handlebars(templateLoader);
handlebars.registerHelper("person", new Helper<Person>() { handlebars.registerHelper("isBusy", new Helper<Person>() {
@Override @Override
public Object apply(Person context, Options options) throws IOException { public Object apply(Person context, Options options) throws IOException {
String busyString = context.isBusy() ? "busy" : "available"; String busyString = context.isBusy() ? "busy" : "available";

View File

@ -2,7 +2,7 @@ package com.baeldung.handlebars;
public class HelperSource { public class HelperSource {
public String person(Person context) { public String isBusy(Person context) {
String busyString = context.isBusy() ? "busy" : "available"; String busyString = context.isBusy() ? "busy" : "available";
return context.getName() + " - " + busyString; return context.getName() + " - " + busyString;
} }

View File

@ -1 +1 @@
{{#person this}}{{/person}} {{#isBusy this}}{{/isBusy}}