test.java.time.temporal.MockFieldValue Java Examples
The following examples show how to use
test.java.time.temporal.MockFieldValue.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestReducedPrinter.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pivot") public void test_pivot(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception { try { getFormatter0(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(YEAR.toString()), true); } else { throw ex; } } }
Example #2
Source File: TestReducedPrinter.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pivot") public void test_pivot(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception { try { getFormatter0(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(YEAR.toString()), true); } else { throw ex; } } }
Example #3
Source File: TestNumberPrinter.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_NOT_NEGATIVE(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.NOT_NEGATIVE).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null || value < 0) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } else { throw ex; } } }
Example #4
Source File: TestReducedPrinter.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pivot") public void test_pivot_baseDate(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception { try { getFormatterBaseDate(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(YEAR.toString()), true); } else { throw ex; } } }
Example #5
Source File: TestReducedPrinter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pivot") public void test_pivot(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception { try { getFormatter0(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(YEAR.toString()), true); } else { throw ex; } } }
Example #6
Source File: TestReducedPrinter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pivot") public void test_pivot_baseDate(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception { try { getFormatterBaseDate(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(YEAR.toString()), true); } else { throw ex; } } }
Example #7
Source File: TestNumberPrinter.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_NOT_NEGATIVE(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.NOT_NEGATIVE).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null || value < 0) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } else { throw ex; } } }
Example #8
Source File: TestNumberPrinter.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_EXCEEDS_PAD(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.EXCEEDS_PAD).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null) { fail("Expected exception"); return; // unreachable } if (result.length() > minPad || value < 0) { result = (value < 0 ? "-" + result : "+" + result); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result != null) { throw ex; } assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } }
Example #9
Source File: TestNumberPrinter.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_EXCEEDS_PAD(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.EXCEEDS_PAD).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null) { fail("Expected exception"); return; // unreachable } if (result.length() > minPad || value < 0) { result = (value < 0 ? "-" + result : "+" + result); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result != null) { throw ex; } assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } }
Example #10
Source File: TestNumberPrinter.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_NOT_NEGATIVE(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.NOT_NEGATIVE).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null || value < 0) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } else { throw ex; } } }
Example #11
Source File: TestNumberPrinter.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_EXCEEDS_PAD(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.EXCEEDS_PAD).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null) { fail("Expected exception"); return; // unreachable } if (result.length() > minPad || value < 0) { result = (value < 0 ? "-" + result : "+" + result); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result != null) { throw ex; } assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } }
Example #12
Source File: TestNumberPrinter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_EXCEEDS_PAD(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.EXCEEDS_PAD).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null) { fail("Expected exception"); return; // unreachable } if (result.length() > minPad || value < 0) { result = (value < 0 ? "-" + result : "+" + result); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result != null) { throw ex; } assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } }
Example #13
Source File: TestReducedPrinter.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pivot") public void test_pivot_baseDate(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception { try { getFormatterBaseDate(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(YEAR.toString()), true); } else { throw ex; } } }
Example #14
Source File: TestNumberPrinter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_NOT_NEGATIVE(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.NOT_NEGATIVE).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null || value < 0) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } else { throw ex; } } }
Example #15
Source File: TestNumberPrinter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_NOT_NEGATIVE(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.NOT_NEGATIVE).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null || value < 0) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } else { throw ex; } } }
Example #16
Source File: TestReducedPrinter.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pivot") public void test_pivot_baseDate(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception { try { getFormatterBaseDate(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(YEAR.toString()), true); } else { throw ex; } } }
Example #17
Source File: TestReducedPrinter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pivot") public void test_pivot_baseDate(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception { try { getFormatterBaseDate(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(YEAR.toString()), true); } else { throw ex; } } }
Example #18
Source File: TestNumberPrinter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_EXCEEDS_PAD(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.EXCEEDS_PAD).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null) { fail("Expected exception"); return; // unreachable } if (result.length() > minPad || value < 0) { result = (value < 0 ? "-" + result : "+" + result); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result != null) { throw ex; } assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } }
Example #19
Source File: TestReducedPrinter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pivot") public void test_pivot(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception { try { getFormatter0(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(YEAR.toString()), true); } else { throw ex; } } }
Example #20
Source File: TestReducedPrinter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pivot") public void test_pivot(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception { try { getFormatter0(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(YEAR.toString()), true); } else { throw ex; } } }
Example #21
Source File: TestReducedPrinter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pivot") public void test_pivot_baseDate(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception { try { getFormatterBaseDate(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(YEAR.toString()), true); } else { throw ex; } } }
Example #22
Source File: TestNumberPrinter.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_NOT_NEGATIVE(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.NOT_NEGATIVE).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null || value < 0) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } else { throw ex; } } }
Example #23
Source File: TestNumberPrinter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_EXCEEDS_PAD(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.EXCEEDS_PAD).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null) { fail("Expected exception"); return; // unreachable } if (result.length() > minPad || value < 0) { result = (value < 0 ? "-" + result : "+" + result); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result != null) { throw ex; } assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } }
Example #24
Source File: TestNumberPrinter.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_EXCEEDS_PAD(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.EXCEEDS_PAD).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null) { fail("Expected exception"); return; // unreachable } if (result.length() > minPad || value < 0) { result = (value < 0 ? "-" + result : "+" + result); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result != null) { throw ex; } assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } }
Example #25
Source File: TestNumberPrinter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pad") public void test_pad_NOT_NEGATIVE(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.NOT_NEGATIVE).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null || value < 0) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } else { throw ex; } } }
Example #26
Source File: TestReducedPrinter.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pivot") public void test_pivot_baseDate(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception { try { getFormatterBaseDate(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(YEAR.toString()), true); } else { throw ex; } } }
Example #27
Source File: TestReducedPrinter.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider="Pivot") public void test_pivot(int minWidth, int maxWidth, int baseValue, int value, String result) throws Exception { try { getFormatter0(YEAR, minWidth, maxWidth, baseValue).formatTo(new MockFieldValue(YEAR, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), result); } catch (DateTimeException ex) { if (result == null || value < 0) { assertEquals(ex.getMessage().contains(YEAR.toString()), true); } else { throw ex; } } }
Example #28
Source File: TestNumberPrinter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="Pad") public void test_pad_ALWAYS(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.ALWAYS).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), (value < 0 ? "-" + result : "+" + result)); } catch (DateTimeException ex) { if (result != null) { throw ex; } assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } }
Example #29
Source File: TestNumberPrinter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="Pad") public void test_pad_NORMAL(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.NORMAL).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), (value < 0 ? "-" + result : result)); } catch (DateTimeException ex) { if (result != null) { throw ex; } assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } }
Example #30
Source File: TestNumberPrinter.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="Pad") public void test_pad_NORMAL(int minPad, int maxPad, long value, String result) throws Exception { try { getFormatter(DAY_OF_MONTH, minPad, maxPad, SignStyle.NORMAL).formatTo(new MockFieldValue(DAY_OF_MONTH, value), buf); if (result == null) { fail("Expected exception"); } assertEquals(buf.toString(), (value < 0 ? "-" + result : result)); } catch (DateTimeException ex) { if (result != null) { throw ex; } assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true); } }