本文整理汇总了Java中org.fosstrak.ale.server.PatternDataField类的典型用法代码示例。如果您正苦于以下问题:Java PatternDataField类的具体用法?Java PatternDataField怎么用?Java PatternDataField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PatternDataField类属于org.fosstrak.ale.server包,在下文中一共展示了PatternDataField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testIsMember
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
@Test
public void testIsMember() throws Exception {
PatternDataField intField = new PatternDataField(INT, PatternUsage.GROUP);
PatternDataField rangeField = new PatternDataField(RANGE, PatternUsage.GROUP);
PatternDataField asteriskField = new PatternDataField(ASTERISK, PatternUsage.GROUP);
PatternDataField xField = new PatternDataField(X, PatternUsage.GROUP);
int member = Integer.parseInt(INT);
int nonMember = HIGH + 100;
// test with member
Assert.assertTrue(intField.isMember(member));
Assert.assertTrue(rangeField.isMember(member));
Assert.assertTrue(asteriskField.isMember(member));
Assert.assertTrue(xField.isMember(member));
// test with non member
Assert.assertFalse(intField.isMember(nonMember));
Assert.assertFalse(rangeField.isMember(nonMember));
Assert.assertTrue(asteriskField.isMember(nonMember));
Assert.assertTrue(xField.isMember(nonMember));
}
示例2: testCreateTagDataFieldWithInvalidStringRepresentation_Range
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
@Test
public void testCreateTagDataFieldWithInvalidStringRepresentation_Range() throws Exception {
try {
new PatternDataField(RANGE, PatternUsage.TAG);
} catch(ECSpecValidationException e) {
Assert.assertEquals("Invalid data field '" + RANGE + "'. Only 'int' is allowed.", e.getMessage());
return;
}
Assert.fail("Should throw an ECSpecValidationException because the string representation of the data field contains a '" + RANGE + "'.");
}
示例3: testCreateTagDataFieldWithInvalidStringRepresentation_Asterisk
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
@Test
public void testCreateTagDataFieldWithInvalidStringRepresentation_Asterisk() throws Exception {
try {
new PatternDataField(ASTERISK, PatternUsage.TAG);
} catch(ECSpecValidationException e) {
Assert.assertEquals("Invalid data field '" + ASTERISK + "'. Only 'int' is allowed.", e.getMessage());
return;
}
Assert.fail("Should throw an ECSpecValidationException because the string representation of the data field contains a '" + ASTERISK + "'.");
}
示例4: testCreateTagDataFieldWithInvalidStringRepresentation_X
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
@Test
public void testCreateTagDataFieldWithInvalidStringRepresentation_X() throws Exception {
try {
new PatternDataField(X, PatternUsage.TAG);
} catch(ECSpecValidationException e) {
Assert.assertEquals("Invalid data field '" + X + "'. Only 'int' is allowed.", e.getMessage());
return;
}
Assert.fail("Should throw an ECSpecValidationException because the string representation of the data field contains a '" + X + "'.");
}
示例5: testCreateTagDataFieldWithInvalidStringRepresentation_Abc
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
@Test
public void testCreateTagDataFieldWithInvalidStringRepresentation_Abc() throws Exception {
try {
new PatternDataField(ABC, PatternUsage.TAG);
} catch(ECSpecValidationException e) {
Assert.assertEquals("Invalid data field '" + ABC + "'. Only 'int' is allowed.", e.getMessage());
return;
}
Assert.fail("Should throw an ECSpecValidationException because the string representation of the data field contains a '" + ABC + "'.");
}
示例6: testCreateFilterDataField
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
@Test
public void testCreateFilterDataField() throws Exception {
new PatternDataField(INT, PatternUsage.FILTER);
new PatternDataField(RANGE, PatternUsage.FILTER);
new PatternDataField(ASTERISK, PatternUsage.FILTER);
}
示例7: testCreateFilterDataFieldWithInvalidStringRepresentation_X
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
@Test
public void testCreateFilterDataFieldWithInvalidStringRepresentation_X() throws Exception {
try {
new PatternDataField(X, PatternUsage.FILTER);
} catch(ECSpecValidationException e) {
Assert.assertEquals("Invalid data field '" + X + "'. Only '*', '[lo-hi]' or 'int' are allowed.", e.getMessage());
return;
}
Assert.fail("Should throw an ECSpecValidationException because the string representation of the data field contains a '" + X + "'.");
}
示例8: testCreateFilterDataFieldWithInvalidStringRepresentation_Abc
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
@Test
public void testCreateFilterDataFieldWithInvalidStringRepresentation_Abc() throws Exception {
try {
new PatternDataField(ABC, PatternUsage.FILTER);
} catch(ECSpecValidationException e) {
Assert.assertEquals("Invalid data field '" + ABC + "'. Only '*', '[lo-hi]' or 'int' are allowed.", e.getMessage());
return;
}
Assert.fail("Should throw an ECSpecValidationException because the string representation of the data field contains a '" + ABC + "'.");
}
示例9: testCreateGroupDataField
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
@Test
public void testCreateGroupDataField() throws Exception {
new PatternDataField(INT, PatternUsage.GROUP);
new PatternDataField(RANGE, PatternUsage.GROUP);
new PatternDataField(ASTERISK, PatternUsage.GROUP);
}
示例10: testCreateGroupDataFieldWithInvalidStringRepresentation_Abc
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
@Test
public void testCreateGroupDataFieldWithInvalidStringRepresentation_Abc() throws Exception {
try {
new PatternDataField(ABC, PatternUsage.GROUP);
} catch(ECSpecValidationException e) {
Assert.assertEquals("Invalid data field '" + ABC + "'. Only '*', 'X', '[lo-hi]' or 'int' are allowed.", e.getMessage());
return;
}
Assert.fail("Should throw an ECSpecValidationException because the string representation of the data field contains a '" + ABC + "'.");
}
示例11: testTypes
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
@Test
public void testTypes() throws Exception {
PatternDataField intField = new PatternDataField(INT, PatternUsage.GROUP);
PatternDataField rangeField = new PatternDataField(RANGE, PatternUsage.GROUP);
PatternDataField asteriskField = new PatternDataField(ASTERISK, PatternUsage.GROUP);
PatternDataField xField = new PatternDataField(X, PatternUsage.GROUP);
Assert.assertTrue(intField.isInt());
Assert.assertFalse(intField.isRange());
Assert.assertFalse(intField.isAsterisk());
Assert.assertFalse(intField.isX());
Assert.assertFalse(rangeField.isInt());
Assert.assertTrue(rangeField.isRange());
Assert.assertFalse(rangeField.isAsterisk());
Assert.assertFalse(rangeField.isX());
Assert.assertFalse(asteriskField.isInt());
Assert.assertFalse(asteriskField.isRange());
Assert.assertTrue(asteriskField.isAsterisk());
Assert.assertFalse(asteriskField.isX());
Assert.assertFalse(xField.isInt());
Assert.assertFalse(xField.isRange());
Assert.assertFalse(xField.isAsterisk());
Assert.assertTrue(xField.isX());
}
示例12: testToString
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
@Test
public void testToString() throws Exception {
PatternDataField intField = new PatternDataField(INT, PatternUsage.GROUP);
PatternDataField rangeField = new PatternDataField(RANGE, PatternUsage.GROUP);
PatternDataField asteriskField = new PatternDataField(ASTERISK, PatternUsage.GROUP);
PatternDataField xField = new PatternDataField(X, PatternUsage.GROUP);
Assert.assertEquals(INT, intField.toString());
Assert.assertEquals(RANGE, rangeField.toString());
Assert.assertEquals(ASTERISK, asteriskField.toString());
Assert.assertEquals(X, xField.toString());
}
示例13: testGetValueWithNonIntDataField
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
/**
* must throw an ECSpecValidationException because data field is not an of type int.
* @throws ECSpecValidationException test expected.
*/
@Test(expected = ECSpecValidationException.class)
public void testGetValueWithNonIntDataField() throws ECSpecValidationException {
PatternDataField rangeField = new PatternDataField(RANGE, PatternUsage.GROUP);
rangeField.getValue();
}
示例14: testGetLowWithNonRangeDataField
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
/**
* must throw an ECSpecValidationException because data field is not of type range.
* @throws ECSpecValidationException test expected.
*/
@Test(expected = ECSpecValidationException.class)
public void testGetLowWithNonRangeDataField() throws Exception {
PatternDataField intField = new PatternDataField(INT, PatternUsage.GROUP);
intField.getLow();
}
示例15: testGetHighWithNonRangeDataField
import org.fosstrak.ale.server.PatternDataField; //导入依赖的package包/类
/**
* must throw an ECSpecValidationException because data field is not of type range.
* @throws ECSpecValidationException test expected.
*/
@Test(expected = ECSpecValidationException.class)
public void testGetHighWithNonRangeDataField() throws Exception {
PatternDataField intField = new PatternDataField(INT, PatternUsage.GROUP);
intField.getHigh();
}