Skip to content

Commit c7ed6bc

Browse files
committed
All tests passing
1 parent 9c17ae2 commit c7ed6bc

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/test/java/com/hubspot/jinjava/el/ExpressionResolverTest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public void unknownProperty() {
257257
interpreter.resolveELExpression("foo", 23);
258258
assertThat(interpreter.getErrorsCopy()).isEmpty();
259259

260-
context.put("foo", new Object());
260+
context.put("foo", "");
261261
interpreter.resolveELExpression("foo.bar", 23);
262262

263263
assertThat(interpreter.getErrorsCopy()).hasSize(1);
@@ -314,7 +314,10 @@ public void blackListedMethods() {
314314

315315
assertThat(interpreter.getErrorsCopy()).isNotEmpty();
316316
TemplateError e = interpreter.getErrorsCopy().get(0);
317-
assertThat(e.getMessage()).contains("Cannot find method 'wait'");
317+
assertThat(e.getMessage())
318+
.contains(
319+
"Cannot find method wait with 0 parameters in class com.hubspot.jinjava.testobjects.ExpressionResolverTestObjects$MyClass"
320+
);
318321
}
319322

320323
@Test
@@ -324,7 +327,10 @@ public void itWillNotReturnClassObjects() {
324327

325328
assertThat(interpreter.getErrorsCopy()).isNotEmpty();
326329
TemplateError e = interpreter.getErrorsCopy().get(0);
327-
assertThat(e.getMessage()).contains("Cannot find method 'getClass'");
330+
assertThat(e.getMessage())
331+
.contains(
332+
"Cannot find method getClass with 0 parameters in class com.hubspot.jinjava.testobjects.ExpressionResolverTestObjects$MyClass"
333+
);
328334
}
329335

330336
@Test

src/test/java/com/hubspot/jinjava/el/ext/JinjavaBeanELResolverTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.hubspot.jinjava.el.ext;
22

33
import static org.assertj.core.api.Assertions.assertThat;
4+
import static org.assertj.core.api.Assertions.assertThatThrownBy;
45

56
import com.hubspot.jinjava.BaseJinjavaTest;
67
import com.hubspot.jinjava.Jinjava;
@@ -9,6 +10,7 @@
910
import com.hubspot.jinjava.interpret.JinjavaInterpreter;
1011
import com.hubspot.jinjava.testobjects.JinjavaBeanELResolverTestObjects;
1112
import javax.el.ELContext;
13+
import javax.el.PropertyNotFoundException;
1214
import org.junit.Before;
1315
import org.junit.Test;
1416

@@ -140,7 +142,10 @@ public void itDoesNotAllowAccessingPropertiesOfInterpreter() {
140142
.closeablePushCurrent(jinjava.newInterpreter())
141143
.get()
142144
) {
143-
assertThat(jinjavaBeanELResolver.getValue(elContext, a.value(), "config")).isNull();
145+
assertThatThrownBy(() ->
146+
jinjavaBeanELResolver.getValue(elContext, a.value(), "config")
147+
)
148+
.isInstanceOf(PropertyNotFoundException.class);
144149
}
145150
}
146151
}

0 commit comments

Comments
 (0)