Class StringValueEscapingTest

java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.broadleafcommerce.admin.web.rulebuilder.StringValueEscapingTest
All Implemented Interfaces:
junit.framework.Test

public class StringValueEscapingTest extends junit.framework.TestCase
Tests that single string values are escaped when translated to MVEL, so they cannot break out of their string literal, and that they are restored when the MVEL is translated back for the rule builder.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    void
    The proof of concept from the report, and splitting a value over two rules with a trailing backslash, must produce a string comparison that MVEL evaluates without running any code.
    void
     
    void
    The value shown in the rule builder must be the value that was entered
    void
     

    Methods inherited from class junit.framework.TestCase

    assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, tearDown, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • StringValueEscapingTest

      public StringValueEscapingTest()
  • Method Details

    • setUp

      protected void setUp()
      Overrides:
      setUp in class junit.framework.TestCase
    • testQuotesAndBackslashesAreEscaped

      public void testQuotesAndBackslashesAreEscaped() throws org.broadleafcommerce.openadmin.web.rulebuilder.MVELTranslationException
      Throws:
      org.broadleafcommerce.openadmin.web.rulebuilder.MVELTranslationException
    • testValuesWithoutQuotesOrBackslashesAreUnchanged

      public void testValuesWithoutQuotesOrBackslashesAreUnchanged() throws org.broadleafcommerce.openadmin.web.rulebuilder.MVELTranslationException
      Throws:
      org.broadleafcommerce.openadmin.web.rulebuilder.MVELTranslationException
    • testInjectedCodeIsNotExecuted

      public void testInjectedCodeIsNotExecuted() throws org.broadleafcommerce.openadmin.web.rulebuilder.MVELTranslationException
      The proof of concept from the report, and splitting a value over two rules with a trailing backslash, must produce a string comparison that MVEL evaluates without running any code.
      Throws:
      org.broadleafcommerce.openadmin.web.rulebuilder.MVELTranslationException
    • testValuesAreRestoredForTheRuleBuilder

      public void testValuesAreRestoredForTheRuleBuilder() throws org.broadleafcommerce.openadmin.web.rulebuilder.MVELTranslationException
      The value shown in the rule builder must be the value that was entered
      Throws:
      org.broadleafcommerce.openadmin.web.rulebuilder.MVELTranslationException