package com.hubspot.jinjava.lib.exptest;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.HashMap;

import org.junit.Before;
import org.junit.Test;

import com.hubspot.jinjava.Jinjava;

public class NegatedExpTestTest {

  private static final String TEMPLATE = "{%% if %s is not %s %%}pass{%% else %%}fail{%% endif %%}";
  private static final String CONTAINING_TEMPLATE = "{%% if %s is not containing %s %%}pass{%% else %%}fail{%% endif %%}";

  private Jinjava jinjava;

  @Before
  public void setup() {
    jinjava = new Jinjava();
  }

  @Test
  public void itNegatesDefined() {
    assertThat(jinjava.render(String.format(TEMPLATE, "blah", "defined"), new HashMap<>())).isEqualTo("pass");
  }

  @Test
  public void itNegatesContaining() {
    assertThat(jinjava.render(String.format(CONTAINING_TEMPLATE, "[1, 2, 3]", "4"), new HashMap<>())).isEqualTo("pass");
  }
}



@@ -297,19 +297,18 @@
 f %25s is 
-not
+%25s
  %25s %25%25%7Dp
@@ -666,16 +666,138 @@
  %22blah%22,
+ %22%22, %22defined%22), new HashMap%3C%3E())).isEqualTo(%22fail%22);%0A    assertThat(jinjava.render(String.format(TEMPLATE, %22blah%22, %22not%22,
  %22define

add control test