Examples of PlainProperties


Examples of net.raymanoz.util.PlainProperties

 
  @Test
  public void shouldBeAbleToReturnSameStringIfVariableNotReplaced() throws IOException {
    String key = "key";
    String expectedValue = "${dog}";
    assertPropertyValue(new PlainProperties(key + "=" + expectedValue), expectedValue, key);
  }
View Full Code Here

Examples of net.raymanoz.util.PlainProperties

  }
 
  @Test
  public void shouldNotReplaceVariablesNotInProperties() throws IOException {
    String findVariable = "findMe";
    Properties properties = new PlainProperties(findVariable + "=replaced");
    VariableEvaluaterImpl evaluater  = new VariableEvaluaterImpl(properties);
    assertEquals("Variables were not replaced correctly", "${ignoreMe} replaced", evaluater.replaceAllVariables("${ignoreMe} ${findMe}"));
  }
View Full Code Here

Examples of net.raymanoz.util.PlainProperties

    assertEquals("Variables were not replaced correctly", "${ignoreMe} replaced", evaluater.replaceAllVariables("${ignoreMe} ${findMe}"));
  }
 
  @Test
  public void shouldBeAbleToFindAVariableWithADotInIt() {
    VariableEvaluaterImpl evaluater = new VariableEvaluaterImpl(new PlainProperties(""));
    Variable variable = evaluater.nextVariable("find this variable: ${script.name}");
    assertNotNull("Varaible could not be found", variable);
  }
View Full Code Here

Examples of net.raymanoz.util.PlainProperties

  }
 
  @Test
  public void shouldBeAbleToReplaceAVariableWithADotInIt() throws IOException {
    String findVariable = "script.name";
    Properties properties = new PlainProperties(findVariable + "=doit.sql");
    VariableEvaluaterImpl evaluater = new VariableEvaluaterImpl(properties);
    assertEquals("Variables were not replaced correctly", "find this variable: doit.sql",
        evaluater.replaceAllVariables("find this variable: ${" + findVariable + "}"));
  }
View Full Code Here

Examples of net.raymanoz.util.PlainProperties

  }

  @Test
  public void shouldHandleBackSlashInVariable() throws IOException {
    String findVariable = "sql";
    Properties properties = new PlainProperties(findVariable + "='\\\\'");
    assertEquals("'\\'", properties.getProperty(findVariable));
    VariableEvaluaterImpl evaluater = new VariableEvaluaterImpl(properties);
    assertEquals("Variables were not replaced correctly", "find this variable: '\\'",
        evaluater.replaceAllVariables("find this variable: ${" + findVariable + "}"));
  }
View Full Code Here

Examples of net.raymanoz.util.PlainProperties

  }
 
  @Test
  public void shouldHandleEscapedDollarInVariable() throws IOException {
    String findVariable = "sql";
    Properties properties = new PlainProperties(findVariable + "=\\$");
    VariableEvaluaterImpl evaluater = new VariableEvaluaterImpl(properties);
    assertEquals("Variables were not replaced correctly", "find this variable: $",
        evaluater.replaceAllVariables("find this variable: ${" + findVariable + "}"));
  }
View Full Code Here

Examples of net.raymanoz.util.PlainProperties

        evaluater.replaceAllVariables("find this variable: ${" + findVariable + "}"));
  }
 
  @Test
  public void shouldHandleNullString() {
    assertNull("Should return null", new VariableEvaluaterImpl(new PlainProperties("a=b")).replaceAllVariables(null));
  }
View Full Code Here

Examples of net.raymanoz.util.PlainProperties

    assertNull("Should return null", new VariableEvaluaterImpl(new PlainProperties("a=b")).replaceAllVariables(null));
  }
 
  private void assertVariable(String value, String variable) {
    assertEquals("Evaluater should find variable " + variable, variable,
        new VariableEvaluaterImpl(new PlainProperties("")).nextVariable(value).getName());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.