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


Java CellProcessor.execute方法代碼示例

本文整理匯總了Java中org.supercsv.cellprocessor.ift.CellProcessor.execute方法的典型用法代碼示例。如果您正苦於以下問題:Java CellProcessor.execute方法的具體用法?Java CellProcessor.execute怎麽用?Java CellProcessor.execute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.supercsv.cellprocessor.ift.CellProcessor的用法示例。


在下文中一共展示了CellProcessor.execute方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: poolStringCellProcessorShouldPoolStringValues

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
@SuppressWarnings({ "RedundantStringConstructorCall", "StringEquality" })
@Test
public void poolStringCellProcessorShouldPoolStringValues() throws Exception {
    CellProcessor proc = new DbIpFileParser.PoolString(new StringPool());
    // Construct strings explicitly to have separate instances
    String input1 = new String("foo");
    String input2 = new String("foo");
    Assume.assumeTrue("Inputs must be different instances of equal strings, otherwise this test is useless",
            input1 != input2 && input1.equals(input2));

    String output1 = proc.execute(input1, dummyContext);
    String output2 = proc.execute(input2, dummyContext);

    assertTrue(output1 == output2);
}
 
開發者ID:shopping24,項目名稱:geoip-dbip-rest-api,代碼行數:16,代碼來源:DbIpFileParserTest.java

示例2: parseInetAddressCellProcessorShouldParseIpv4Addresses

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
@Test
public void parseInetAddressCellProcessorShouldParseIpv4Addresses() throws Exception {
    CellProcessor proc = new DbIpFileParser.ParseInetAddress();
    InetAddress address = proc.execute("192.168.0.0", dummyContext);
    assertTrue(address instanceof Inet4Address);
    assertArrayEquals(new byte[] { (byte) 192, (byte) 168, 0, 0 }, address.getAddress());
}
 
開發者ID:shopping24,項目名稱:geoip-dbip-rest-api,代碼行數:8,代碼來源:DbIpFileParserTest.java

示例3: parseInetAddressCellProcessorShouldParseIpv6Addresses

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
@Test
public void parseInetAddressCellProcessorShouldParseIpv6Addresses() throws Exception {
    CellProcessor proc = new DbIpFileParser.ParseInetAddress();
    InetAddress address = proc.execute("2001:db8:1::", dummyContext);
    assertTrue(address instanceof Inet6Address);
    assertArrayEquals(new byte[] { 0x20, 0x01, 0x0d, (byte) 0xb8, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00 }, address.getAddress());
}
 
開發者ID:shopping24,項目名稱:geoip-dbip-rest-api,代碼行數:9,代碼來源:DbIpFileParserTest.java

示例4: testNullInput

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
@Test
public void testNullInput() {
	for (CellProcessor p : processors) {
		try {
			p.execute(null, ANONYMOUS_CSVCONTEXT);
			fail("expecting SuperCsvCellProcessorException");
		} catch (SuperCsvCellProcessorException e) {
			assertEquals(
					"this processor does not accept null input - "
							+ "if the column is optional then chain an Optional() processor before this one",
					e.getMessage());
		}
	}
}
 
開發者ID:super-csv,項目名稱:super-csv,代碼行數:15,代碼來源:FmtDateTimeTest.java

示例5: testInvalidDateWithNonLenient

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
/**
 * Tests execution with an invalid date (matches format, but data invalid) and non-lenient processors (should throw
 * an exception).
 */
@Test
public void testInvalidDateWithNonLenient() {
	final String dodgyDate = "30/02/2012";
	for( final CellProcessor cp : Arrays.asList(processor, processor3, processorChain, processorChain3) ) {
		try {
			cp.execute(dodgyDate, ANONYMOUS_CSVCONTEXT);
			fail("should have thrown a SuperCsvCellProcessorException");
		}
		catch(SuperCsvCellProcessorException e) {}
	}
}
 
開發者ID:super-csv,項目名稱:super-csv,代碼行數:16,代碼來源:ParseDateTest.java

示例6: testNonDurationInput

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
@Test
public void testNonDurationInput() {
	for (CellProcessor p : processors) {
		try {
			p.execute(123, ANONYMOUS_CSVCONTEXT);
			fail("expecting SuperCsvCellProcessorException");
		} catch (SuperCsvCellProcessorException e) {
			assertEquals(
					"the input value should be of type org.joda.time.Duration but is java.lang.Integer",
					e.getMessage());
		}
	}
}
 
開發者ID:super-csv,項目名稱:super-csv,代碼行數:14,代碼來源:FmtDurationTest.java

示例7: testWithNullNumberFormat

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
/**
 * Tests execution with a invalid number format object (should throw an Exception).
 */
@Test(expected = NullPointerException.class)
public void testWithNullNumberFormat() {
	final double number = 12.34;
	CellProcessor invalidNumberFormatProcessor = new FmtNumber((DecimalFormat) null);
	invalidNumberFormatProcessor.execute(number, ANONYMOUS_CSVCONTEXT);
}
 
開發者ID:super-csv,項目名稱:super-csv,代碼行數:10,代碼來源:FmtNumberTest.java

示例8: testUnparsableString

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
@Test
public void testUnparsableString() {
	for (CellProcessor p : processors) {
		try {
			p.execute("not valid", ANONYMOUS_CSVCONTEXT);
			fail("expecting SuperCsvCellProcessorException");
		} catch (SuperCsvCellProcessorException e) {
			assertEquals("Failed to parse value", e.getMessage());
		}
	}
}
 
開發者ID:super-csv,項目名稱:super-csv,代碼行數:12,代碼來源:ParseLocalDateTimeTest.java

示例9: testNonStringInput

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
@Test
public void testNonStringInput() {
	for (CellProcessor p : processors) {
		try {
			p.execute(123, ANONYMOUS_CSVCONTEXT);
			fail("expecting SuperCsvCellProcessorException");
		} catch (SuperCsvCellProcessorException e) {
			assertEquals(
					"the input value should be of type java.lang.String but is java.lang.Integer",
					e.getMessage());
		}
	}
}
 
開發者ID:super-csv,項目名稱:super-csv,代碼行數:14,代碼來源:ParseLocalDateTest.java

示例10: testInvalidDateFormat

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
@Test
public void testInvalidDateFormat() {
	final CellProcessor p = new FmtLocalTime("not valid");
	try {
		p.execute(LOCAL_TIME, ANONYMOUS_CSVCONTEXT);
		fail("expecting SuperCsvCellProcessorException");
	} catch (SuperCsvCellProcessorException e) {
		assertEquals("Failed to format value as a LocalTime",
				e.getMessage());
	}
}
 
開發者ID:super-csv,項目名稱:super-csv,代碼行數:12,代碼來源:FmtLocalTimeTest.java

示例11: testNonIntervalInput

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
@Test
public void testNonIntervalInput() {
	for (CellProcessor p : processors) {
		try {
			p.execute(123, ANONYMOUS_CSVCONTEXT);
			fail("expecting SuperCsvCellProcessorException");
		} catch (SuperCsvCellProcessorException e) {
			assertEquals(
					"the input value should be of type org.joda.time.Interval but is java.lang.Integer",
					e.getMessage());
		}
	}
}
 
開發者ID:super-csv,項目名稱:super-csv,代碼行數:14,代碼來源:FmtIntervalTest.java

示例12: testUnparsableString

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
@Test
public void testUnparsableString() {
	for (CellProcessor p : processors) {
		try {
			p.execute("not valid", ANONYMOUS_CSVCONTEXT);
			fail("expecting SuperCsvCellProcessorException");
		} catch (SuperCsvCellProcessorException e) {
			assertEquals("Failed to parse value as a Period", e.getMessage());
		}
	}
}
 
開發者ID:super-csv,項目名稱:super-csv,代碼行數:12,代碼來源:ParsePeriodTest.java

示例13: testNonLocalDateInput

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
@Test
public void testNonLocalDateInput() {
	for (CellProcessor p : processors) {
		try {
			p.execute(123, ANONYMOUS_CSVCONTEXT);
			fail("expecting SuperCsvCellProcessorException");
		} catch (SuperCsvCellProcessorException e) {
			assertEquals(
					"the input value should be of type org.joda.time.LocalDate but is java.lang.Integer",
					e.getMessage());
		}
	}
}
 
開發者ID:super-csv,項目名稱:super-csv,代碼行數:14,代碼來源:FmtLocalDateTest.java

示例14: testInvalidDateFormat

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
@Test
public void testInvalidDateFormat() {
	final CellProcessor p = new FmtLocalDate("not valid");
	try {
		p.execute(LOCAL_DATE, ANONYMOUS_CSVCONTEXT);
		fail("expecting SuperCsvCellProcessorException");
	} catch (SuperCsvCellProcessorException e) {
		assertEquals("Failed to format value as a LocalDate", e.getMessage());
	}
}
 
開發者ID:super-csv,項目名稱:super-csv,代碼行數:11,代碼來源:FmtLocalDateTest.java

示例15: testUnparsableString

import org.supercsv.cellprocessor.ift.CellProcessor; //導入方法依賴的package包/類
@Test
public void testUnparsableString() {
	for (CellProcessor p : processors) {
		try {
			p.execute("not valid", ANONYMOUS_CSVCONTEXT);
			fail("expecting SuperCsvCellProcessorException");
		} catch (SuperCsvCellProcessorException e) {
			assertEquals("Failed to parse value as a Duration",
					e.getMessage());
		}
	}
}
 
開發者ID:super-csv,項目名稱:super-csv,代碼行數:13,代碼來源:ParseDurationTest.java


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