1 8 9 package com.sleepycat.je.config; 10 11 import junit.framework.TestCase; 12 13 public class EnvironmentParamsTest extends TestCase { 14 15 16 private IntConfigParam intParam = 17 new IntConfigParam("param.int", 18 new Integer (2), 19 new Integer (10), 20 new Integer (5), 21 false, false, "test int param"); 24 25 private LongConfigParam longParam = 26 new LongConfigParam("param.long", 27 new Long (2), 28 new Long (10), 29 new Long (5), 30 false, false, "test long param"); 33 34 35 38 public void testValidation() { 39 try { 40 ConfigParam param = new ConfigParam(null, 41 "foo", 42 false, false, "foo param"); 45 fail("should disallow null name"); 46 } catch (IllegalArgumentException e) { 47 } 49 50 51 checkValidateParam(intParam, "1"); 52 checkValidateParam(intParam, "11"); 53 checkValidateParam(longParam, "1"); 54 checkValidateParam(longParam, "11"); 55 } 56 57 58 private void checkValidateParam(ConfigParam param, String value) { 59 try { 60 param.validateValue(value); 61 fail("Should throw exception"); 62 } catch (IllegalArgumentException e) { 63 } 65 } 66 } 67 | Popular Tags |