Search in sources :

Example 36 with Options

use of com.github.jknack.handlebars.Options in project ddf by codice.

the class DescriptionTemplateHelperTest method testNoThumbnailHasThumbnail.

@Test
public void testNoThumbnailHasThumbnail() throws IOException {
    String ifOption = "if";
    String elseOption = "else";
    Metacard metacard = new MetacardImpl();
    Options mockOptions = mock(Options.class);
    when(mockOptions.fn()).thenReturn(ifOption);
    when(mockOptions.inverse()).thenReturn(elseOption);
    String result = helper.hasThumbnail(metacard, mockOptions).toString();
    assertEquals(elseOption, result);
}
Also used : Options(com.github.jknack.handlebars.Options) Metacard(ddf.catalog.data.Metacard) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Test(org.junit.Test)

Aggregations

Options (com.github.jknack.handlebars.Options)36 Test (org.junit.Test)35 Context (com.github.jknack.handlebars.Context)8 ObjectSchema (io.swagger.v3.oas.models.media.ObjectSchema)5 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)4 IOException (java.io.IOException)4 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 ArraySchema (io.swagger.v3.oas.models.media.ArraySchema)3 ComposedSchema (io.swagger.v3.oas.models.media.ComposedSchema)3 Schema (io.swagger.v3.oas.models.media.Schema)3 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)2 Metacard (ddf.catalog.data.Metacard)2 ThrowingRunnable (org.junit.function.ThrowingRunnable)2 UncheckedIOException (java.io.UncheckedIOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Hash (uk.nhs.digital.common.components.apispecification.handlebars.OptionsStub.Hash)1 RandomTestUtils.randomString (uk.nhs.digital.test.util.RandomTestUtils.randomString)1