コード例 #1
0
 public void testJVMParameterProviderDifferentPath() {
   startTest();
   JVMParameterProvider provider = new JVMParameterProvider();
   assertEquals(99, provider.getLongParameter("bogus", 99)); // $NON-NLS-1$
   assertEquals(
       new BigDecimal("99"),
       provider.getDecimalParameter(
           "bogus", new BigDecimal("99"))); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
   finishTest();
 }
コード例 #2
0
  public void testJVMParameterProvider() {
    startTest();
    System.setProperty("teststring", "test string"); // $NON-NLS-1$//$NON-NLS-2$
    System.setProperty("testlong", "32"); // $NON-NLS-1$//$NON-NLS-2$
    System.setProperty("testdecimal", "66.6"); // $NON-NLS-1$//$NON-NLS-2$
    Date someDate = new Date();
    System.setProperty("testdate", DateFormat.getInstance().format(someDate)); // $NON-NLS-1$

    JVMParameterProvider provider = new JVMParameterProvider();

    //  assertEquals(someDate, provider.getDateParameter("testdate", null) ); //$NON-NLS-1$
    assertEquals(someDate, provider.getDateParameter("bogus", someDate)); // $NON-NLS-1$
    assertEquals(32, provider.getLongParameter("testlong", 0)); // $NON-NLS-1$
    assertEquals(
        "test string",
        provider.getStringParameter("teststring", null)); // $NON-NLS-1$ //$NON-NLS-2$
    assertEquals(
        new BigDecimal("66.6"),
        provider.getDecimalParameter("testdecimal", null)); // $NON-NLS-1$ //$NON-NLS-2$

    assertEquals("test string", provider.getParameter("teststring")); // $NON-NLS-1$ //$NON-NLS-2$
    assertEquals("string", provider.getParameterType("teststring")); // $NON-NLS-1$ //$NON-NLS-2$

    Iterator it = provider.getParameterNames();
    while (it.hasNext()) {
      String pName = (String) it.next();
      System.out.println(pName + "=" + provider.getStringParameter(pName, null)); // $NON-NLS-1$
    }
    finishTest();
  }
コード例 #3
0
 public void testJVMParameterProviderDifferentPath2() {
   startTest();
   JVMParameterProvider provider = new JVMParameterProvider();
   try {
     Object parameterValue = provider.getDecimalParameter("bogus", null); // $NON-NLS-1$
     System.out.println("Paramater Value Received is " + parameterValue); // $NON-NLS-1$
   } catch (Exception e) {
     e.printStackTrace();
     assertTrue("Expected exception was caught", true); // $NON-NLS-1$
   }
   finishTest();
 }