use of javax.el.ELContext in project ART-TIME by Artezio.
the class CustomOutputLabelRendererTest method testDetermineRequireness.
@Test
public void testDetermineRequireness() throws Exception {
TestObject testObject = new TestObject();
ELContext elContext = createMock(ELContext.class);
setField(renderer, "elContext", elContext);
UIComponent component = createMock(UIComponent.class);
ValueExpression valueExpression = createMock(ValueExpression.class);
ValueReference valueReference = createMock(ValueReference.class);
PowerMock.mockStatic(ValueExpressionAnalyzer.class);
expect(component.getValueExpression("value")).andReturn(valueExpression);
expect(ValueExpressionAnalyzer.getReference(elContext, valueExpression)).andReturn(valueReference);
expect(valueReference.getBase()).andReturn(testObject);
expect(valueReference.getProperty()).andReturn("attr_1");
PowerMock.replayAll(ValueExpressionAnalyzer.class, component, valueReference);
boolean actual = renderer.determineRequireness(component);
PowerMock.verifyAll();
assertFalse(actual);
}
use of javax.el.ELContext in project ART-TIME by Artezio.
the class CustomOutputLabelRendererTest method testDetermineRequireness_ifFieldMarkNotNull.
@Test
public void testDetermineRequireness_ifFieldMarkNotNull() throws Exception {
TestObject testObject = new TestObject();
ELContext elContext = createMock(ELContext.class);
setField(renderer, "elContext", elContext);
UIComponent component = createMock(UIComponent.class);
ValueExpression valueExpression = createMock(ValueExpression.class);
ValueReference valueReference = createMock(ValueReference.class);
PowerMock.mockStatic(ValueExpressionAnalyzer.class);
expect(component.getValueExpression("value")).andReturn(valueExpression);
expect(ValueExpressionAnalyzer.getReference(elContext, valueExpression)).andReturn(valueReference);
expect(valueReference.getBase()).andReturn(testObject);
expect(valueReference.getProperty()).andReturn("notNullAttr");
PowerMock.replayAll(ValueExpressionAnalyzer.class, component, valueReference);
boolean actual = renderer.determineRequireness(component);
PowerMock.verifyAll();
assertTrue(actual);
}
use of javax.el.ELContext in project ART-TIME by Artezio.
the class CustomOutputLabelRendererTest method testDetermineRequireness_ifGetterMarkNotBlank.
@Test
public void testDetermineRequireness_ifGetterMarkNotBlank() throws Exception {
TestObject testObject = new TestObject();
ELContext elContext = createMock(ELContext.class);
setField(renderer, "elContext", elContext);
UIComponent component = createMock(UIComponent.class);
ValueExpression valueExpression = createMock(ValueExpression.class);
ValueReference valueReference = createMock(ValueReference.class);
PowerMock.mockStatic(ValueExpressionAnalyzer.class);
expect(component.getValueExpression("value")).andReturn(valueExpression);
expect(ValueExpressionAnalyzer.getReference(elContext, valueExpression)).andReturn(valueReference);
expect(valueReference.getBase()).andReturn(testObject);
expect(valueReference.getProperty()).andReturn("notBlankAttr");
PowerMock.replayAll(ValueExpressionAnalyzer.class, component, valueReference);
boolean actual = renderer.determineRequireness(component);
PowerMock.verifyAll();
assertTrue(actual);
}
use of javax.el.ELContext in project ART-TIME by Artezio.
the class CustomOutputLabelRendererTest method testDetermineRequireness_ifFieldIsNull.
@Test
public void testDetermineRequireness_ifFieldIsNull() throws Exception {
TestObject testObject = new TestObject();
ELContext elContext = createMock(ELContext.class);
setField(renderer, "elContext", elContext);
UIComponent component = createMock(UIComponent.class);
ValueExpression valueExpression = createMock(ValueExpression.class);
ValueReference valueReference = createMock(ValueReference.class);
PowerMock.mockStatic(ValueExpressionAnalyzer.class);
expect(component.getValueExpression("value")).andReturn(valueExpression);
expect(ValueExpressionAnalyzer.getReference(elContext, valueExpression)).andReturn(valueReference);
expect(valueReference.getBase()).andReturn(testObject);
expect(valueReference.getProperty()).andReturn("not_existed_attr");
PowerMock.replayAll(ValueExpressionAnalyzer.class, component, valueReference);
boolean actual = renderer.determineRequireness(component);
PowerMock.verifyAll();
assertFalse(actual);
}
use of javax.el.ELContext in project ART-TIME by Artezio.
the class CustomOutputLabelRendererTest method testDetermineRequireness_ifValueReferenceIsNull.
@Test
public void testDetermineRequireness_ifValueReferenceIsNull() throws Exception {
ELContext elContext = createMock(ELContext.class);
setField(renderer, "elContext", elContext);
UIComponent component = createMock(UIComponent.class);
ValueExpression valueExpression = createMock(ValueExpression.class);
PowerMock.mockStatic(ValueExpressionAnalyzer.class);
expect(component.getValueExpression("value")).andReturn(valueExpression);
expect(ValueExpressionAnalyzer.getReference(elContext, valueExpression)).andReturn(null);
PowerMock.replayAll(ValueExpressionAnalyzer.class, component);
boolean actual = renderer.determineRequireness(component);
PowerMock.verifyAll();
assertFalse(actual);
}
Aggregations