Commit a95eefc5 authored by azara's avatar azara
Browse files

Merge pull request #350 from bonitasoft/fix/BS-14768_handleMessageContentType

BS-14768: Include Message Content Type for expression in databinding
parents ba467063 fba5bd39
......@@ -16,6 +16,7 @@ package org.bonitasoft.studio.expression.editor.viewer;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doCallRealMethod;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.verify;
......@@ -133,4 +134,22 @@ public class ExpressionViewerTest {
assertThat(mockedExprViewer.isOldContextAndInputSimilar(input2)).isFalse();
}
@Test
public void getContentTypeFromInputNullSupport() throws Exception {
doCallRealMethod().when(mockedExprViewer).getContentTypeFromInput(anyString());
final Expression selectedExpression = ExpressionBuilder.aConstantExpression().build();
doReturn(selectedExpression).when(mockedExprViewer).getSelectedExpression();
assertThat(mockedExprViewer.getContentTypeFromInput("test")).isEqualTo(ExpressionConstants.CONSTANT_TYPE);
}
@Test
public void getContentTypeFromInputMessageContent() throws Exception {
doCallRealMethod().when(mockedExprViewer).getContentTypeFromInput(anyString());
final Expression selectedExpression = ExpressionBuilder.anExpression().withExpressionType(ExpressionConstants.MESSAGE_ID_TYPE).build();
doReturn(selectedExpression).when(mockedExprViewer).getSelectedExpression();
assertThat(mockedExprViewer.getContentTypeFromInput("test")).isEqualTo(ExpressionConstants.MESSAGE_ID_TYPE);
}
}
......@@ -938,6 +938,8 @@ public class ExpressionViewer extends ContentViewer implements ExpressionConstan
return ExpressionConstants.SEARCH_INDEX_TYPE;
} else if (ExpressionConstants.QUERY_TYPE.equals(expressionType)) {
return ExpressionConstants.QUERY_TYPE;
} else if (ExpressionConstants.MESSAGE_ID_TYPE.equals(expressionType)) {
return ExpressionConstants.MESSAGE_ID_TYPE;
}
final Set<String> cache = new HashSet<String>();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment