當前位置: 首頁>>代碼示例>>Java>>正文


Java PatternDataField類代碼示例

本文整理匯總了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));
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:24,代碼來源:PatternDataFieldTest.java

示例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 + "'.");
	
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:14,代碼來源:PatternDataFieldTest.java

示例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 + "'.");
	
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:14,代碼來源:PatternDataFieldTest.java

示例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 + "'.");
	
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:14,代碼來源:PatternDataFieldTest.java

示例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 + "'.");
	
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:14,代碼來源:PatternDataFieldTest.java

示例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);
	
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:9,代碼來源:PatternDataFieldTest.java

示例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 + "'.");
	
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:14,代碼來源:PatternDataFieldTest.java

示例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 + "'.");
	
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:14,代碼來源:PatternDataFieldTest.java

示例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);
	
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:9,代碼來源:PatternDataFieldTest.java

示例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 + "'.");
	
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:14,代碼來源:PatternDataFieldTest.java

示例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());
	
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:30,代碼來源:PatternDataFieldTest.java

示例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());
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:14,代碼來源:PatternDataFieldTest.java

示例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();		
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:10,代碼來源:PatternDataFieldTest.java

示例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();
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:10,代碼來源:PatternDataFieldTest.java

示例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();
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:10,代碼來源:PatternDataFieldTest.java


注:本文中的org.fosstrak.ale.server.PatternDataField類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。