当前位置: 首页>>代码示例>>Java>>正文


Java TDTException类代码示例

本文整理汇总了Java中org.fosstrak.tdt.TDTException的典型用法代码示例。如果您正苦于以下问题:Java TDTException类的具体用法?Java TDTException怎么用?Java TDTException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TDTException类属于org.fosstrak.tdt包,在下文中一共展示了TDTException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAddTagAsRawDecimalErrorInTDT

import org.fosstrak.tdt.TDTException; //导入依赖的package包/类
/**
 * test adding a tag as raw decimal - test the case where TDT has a problem.
 */
@Test
public void testAddTagAsRawDecimalErrorInTDT() {		
	final String original = "original";
	
	TDTEngine tdt = EasyMock.createMock(TDTEngine.class);
	EasyMock.expect(tdt.bin2dec(original)).andThrow(new TDTException("MOCK EXCEPTION"));
	EasyMock.replay(tdt);		
	TagHelper.setTDTEngine(null);
	
	ECReportGroupListMember groupMember = EasyMock.createMock(ECReportGroupListMember.class);
	EasyMock.replay(groupMember);
	
	Tag tag = EasyMock.createMock(Tag.class);
	EasyMock.expect(tag.getTagAsBinary()).andReturn(original).atLeastOnce();
	EasyMock.replay(tag);
	
	Assert.assertNull(TagHelper.addTagAsRawDecimal(tdt, groupMember, tag));
	EasyMock.verify(tdt);
	EasyMock.verify(tag);
	EasyMock.verify(groupMember);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:25,代码来源:TagHelperTest.java

示例2: testAddTagAsTagEncodingErrorInTDT

import org.fosstrak.tdt.TDTException; //导入依赖的package包/类
/**
 * test adding a tag as tag encoding - test the case where TDT has a problem.
 */
@SuppressWarnings("unchecked")
@Test
public void testAddTagAsTagEncodingErrorInTDT() {		
	final String original = "original";
	
	TDTEngine tdt = EasyMock.createMock(TDTEngine.class);
	EasyMock.expect(tdt.convert(EasyMock.eq(original), EasyMock.isA(Map.class), EasyMock.eq(LevelTypeList.TAG_ENCODING))).andThrow(new TDTException("MOCK EXCEPTION"));
	EasyMock.replay(tdt);		
	TagHelper.setTDTEngine(null);
	
	ECReportGroupListMember groupMember = EasyMock.createMock(ECReportGroupListMember.class);
	EasyMock.replay(groupMember);
	
	Tag tag = EasyMock.createMock(Tag.class);
	EasyMock.expect(tag.getTagAsBinary()).andReturn(original).atLeastOnce();
	EasyMock.expect(tag.getTagLength()).andReturn("tagLength").atLeastOnce();
	EasyMock.expect(tag.getFilter()).andReturn("tagFilter").atLeastOnce();
	EasyMock.expect(tag.getCompanyPrefixLength()).andReturn("companyPrefixLength").atLeastOnce();
	EasyMock.replay(tag);
	
	Assert.assertNull(TagHelper.addTagAsTagEncoding(tdt, groupMember, tag));
	EasyMock.verify(tdt);
	EasyMock.verify(tag);
	EasyMock.verify(groupMember);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:29,代码来源:TagHelperTest.java

示例3: testAddTagAsRawHexErrorInTDT

import org.fosstrak.tdt.TDTException; //导入依赖的package包/类
/**
 * test adding a tag as raw hex - test the case where TDT has a problem.
 */
@Test
public void testAddTagAsRawHexErrorInTDT() {		
	final String original = "original";
	
	TDTEngine tdt = EasyMock.createMock(TDTEngine.class);
	EasyMock.expect(tdt.bin2hex(original)).andThrow(new TDTException("MOCK EXCEPTION"));
	EasyMock.replay(tdt);		
	TagHelper.setTDTEngine(null);
	
	ECReportGroupListMember groupMember = EasyMock.createMock(ECReportGroupListMember.class);
	EasyMock.replay(groupMember);
	
	Tag tag = EasyMock.createMock(Tag.class);
	EasyMock.expect(tag.getTagAsBinary()).andReturn(original).atLeastOnce();
	EasyMock.replay(tag);
	
	Assert.assertNull(TagHelper.addTagAsRawHex(tdt, groupMember, tag));
	EasyMock.verify(tdt);
	EasyMock.verify(tag);
	EasyMock.verify(groupMember);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:25,代码来源:TagHelperTest.java

示例4: convert

import org.fosstrak.tdt.TDTException; //导入依赖的package包/类
/**
 * converts a given input with the given TDT to the desired output format.
 * @param input the tag to convert. Must be in binary format or in TAG_ENCODING.
 * @param extraparms conversion parameters.
 * @param outputLevel the destination format.
 * @return the converted tag.
 * @throws TDTException whenever a tag conversion error occurs.
 */
public static String convert(String input, Map<String, String> extraparms, LevelTypeList outputLevel, TDTEngine tdt) throws TDTException {
	try {
		return tdt.convert(input, extraparms, outputLevel);			
	} catch (NullPointerException npe) {
		LOG.error("caught NullPointerException during transformation - could not perform the transformation ", npe);
		throw new TDTException("caught NullPointerException during transformation - could not perform the transformation " + npe.getMessage());
	}
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:17,代码来源:TagHelper.java

示例5: testAddTagAsEPCErrorInTDT

import org.fosstrak.tdt.TDTException; //导入依赖的package包/类
/**
 * test adding a tag as EPC - test the case where TDT has a problem.
 */
@SuppressWarnings("unchecked")
@Test
public void testAddTagAsEPCErrorInTDT() {	
	final String original = "original";
	final String pureURI = "pureURI";
	
	TDTEngine tdt = EasyMock.createMock(TDTEngine.class);
	EasyMock.expect(tdt.convert(EasyMock.eq(original), EasyMock.isA(Map.class), EasyMock.eq(LevelTypeList.PURE_IDENTITY))).andThrow(new TDTException("MOCK EXCEPTION"));
	EasyMock.replay(tdt);		
	TagHelper.setTDTEngine(null);
	
	ECReportGroupListMember groupMember = EasyMock.createMock(ECReportGroupListMember.class);
	groupMember.setEpc(EasyMock.isA(EPC.class));
	EasyMock.expectLastCall();
	EasyMock.replay(groupMember);
	
	Tag tag = EasyMock.createMock(Tag.class);
	EasyMock.expect(tag.getTagAsBinary()).andReturn(original).atLeastOnce();
	EasyMock.expect(tag.getTagLength()).andReturn("tagLength").atLeastOnce();
	EasyMock.expect(tag.getFilter()).andReturn("tagFilter").atLeastOnce();
	EasyMock.expect(tag.getCompanyPrefixLength()).andReturn("companyPrefixLength").atLeastOnce();
	EasyMock.expect(tag.getTagIDAsPureURI()).andReturn(pureURI).atLeastOnce();
	EasyMock.replay(tag);
	
	Assert.assertEquals(pureURI, TagHelper.addTagAsEPC(tdt, groupMember, tag));
	EasyMock.verify(tdt);
	EasyMock.verify(tag);
	EasyMock.verify(groupMember);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:33,代码来源:TagHelperTest.java

示例6: testTDTNotThrowingNullPointerException

import org.fosstrak.tdt.TDTException; //导入依赖的package包/类
/**
 * TagHelper must not throw NullPointerException - only TDTException is allowed. 
 */
@Test(expected = TDTException.class)
public void testTDTNotThrowingNullPointerException() {
	TagHelper.setTDTEngine(null);
	TagHelper.convert(null, null, null, null);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:9,代码来源:TagHelperTest.java


注:本文中的org.fosstrak.tdt.TDTException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。