use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameter in project constellation by constellation-app.
the class BooleanParameterTypeNGTest method testBuild_String_BooleanParameterTypeBooleanParameterValue.
/**
* Test of build method, of class BooleanParameterType.
*/
@Test
public void testBuild_String_BooleanParameterTypeBooleanParameterValue() {
System.out.println("build_string_parametertype");
String id = "booleanParameter";
BooleanParameterValue parameterValue = new BooleanParameterValue();
PluginParameter result = BooleanParameterType.build(id, parameterValue);
assertEquals(result.getId(), id);
assertTrue(result.getType() instanceof BooleanParameterType);
assertEquals(result.getParameterValue(), parameterValue);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameter in project constellation by constellation-app.
the class IntegerParameterTypeNGTest method testValidateString.
/**
* Test of validateString method, of class IntegerParameterType.
*/
@Test
public void testValidateString() {
System.out.println("validateString");
String id = "validate string";
IntegerParameterType instance = new IntegerParameterType();
PluginParameter<IntegerParameterType.IntegerParameterValue> parameter = new PluginParameter<>(new IntegerParameterValue(), INSTANCE, id);
IntegerParameterType.setMaximum(parameter, 5);
IntegerParameterType.setMinimum(parameter, 0);
// test valid integer in min-max range
// should return null
String passingValue = "2";
String result = instance.validateString(parameter, passingValue);
assertEquals(result, null);
// test invalid integer under min range
// should return value too small
passingValue = "-1";
result = instance.validateString(parameter, passingValue);
assertEquals(result, "Value too small");
// test invalid integer over max range
// should return value too small
passingValue = "6";
result = instance.validateString(parameter, passingValue);
assertEquals(result, "Value too large");
// test invalid integer
// should return Not a valid integer
passingValue = "This is a Test";
result = instance.validateString(parameter, passingValue);
assertEquals(result, "Not a valid integer");
// test a 0
// should return null
passingValue = "0";
result = instance.validateString(parameter, passingValue);
assertEquals(result, null);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameter in project constellation by constellation-app.
the class PasswordParameterTypeNGTest method testBuild_String.
/**
* Test of build method, of class PasswordParameterType.
*/
@Test
public void testBuild_String() {
System.out.println("build");
String id = "password parameter";
PluginParameter result = PasswordParameterType.build(id);
PasswordParameterValue expResult = new PasswordParameterValue();
System.out.println(expResult.toString());
assertEquals(result.getId(), id);
assertTrue(result.getType() instanceof PasswordParameterType);
assertEquals(result.getParameterValue(), expResult);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameter in project constellation by constellation-app.
the class StringParameterTypeNGTest method testGetLines.
/**
* Test of getLines method, of class StringParameterType.
*/
@Test
public void testGetLines() {
System.out.println("getLines");
PluginParameter instance = StringParameterType.build("stringParameter");
// check the expected result and result equal when postivie integers
Integer expResult = 5;
instance.setProperty(StringParameterType.LINES, expResult);
Integer result = StringParameterType.getLines(instance);
assertEquals(result, expResult);
// check the expected result and result equal when 0
expResult = 0;
instance.setProperty(StringParameterType.LINES, expResult);
result = StringParameterType.getLines(instance);
assertEquals(result, expResult);
// check the expected result and result equal when negative integers
expResult = -1;
instance.setProperty(StringParameterType.LINES, expResult);
result = StringParameterType.getLines(instance);
assertEquals(result, expResult);
// check the expected result and result equal when null
expResult = null;
instance.setProperty(StringParameterType.LINES, expResult);
result = StringParameterType.getLines(instance);
assertEquals(result, expResult);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameter in project constellation by constellation-app.
the class StringParameterTypeNGTest method testBuild_String_StringParameterValue.
/**
* Test of build method, of class StringParameterType.
*/
@Test
public void testBuild_String_StringParameterValue() {
System.out.println("build_string_parametertype");
String id = "stringParameter";
StringParameterValue parameterValue = new StringParameterValue();
PluginParameter result = StringParameterType.build(id, parameterValue);
assertEquals(result.getId(), id);
assertTrue(result.getType() instanceof StringParameterType);
assertEquals(result.getParameterValue(), parameterValue);
}
Aggregations