|
| 1 | +package com.jsoniter; |
| 2 | + |
| 3 | +import com.jsoniter.spi.OmitValue.*; |
| 4 | +import junit.framework.TestCase; |
| 5 | + |
| 6 | +public class TestOmitValue extends TestCase { |
| 7 | + |
| 8 | + public void test_shouldOmitInputPositiveOutputFalse() { |
| 9 | + |
| 10 | + // Arrange |
| 11 | + final ZeroByte objectUnderTest = new ZeroByte(); |
| 12 | + final Object val = (byte)1; |
| 13 | + |
| 14 | + // Act |
| 15 | + final boolean retval = objectUnderTest.shouldOmit(val); |
| 16 | + |
| 17 | + // Assert result |
| 18 | + assertEquals(false, retval); |
| 19 | + } |
| 20 | + |
| 21 | + public void test_shouldOmitInputPositiveOutputFalse2() { |
| 22 | + |
| 23 | + // Arrange |
| 24 | + final ZeroInt objectUnderTest = new ZeroInt(); |
| 25 | + final Object val = 1; |
| 26 | + |
| 27 | + // Act |
| 28 | + final boolean retval = objectUnderTest.shouldOmit(val); |
| 29 | + |
| 30 | + // Assert result |
| 31 | + assertEquals(false, retval); |
| 32 | + } |
| 33 | + |
| 34 | + public void test_shouldOmitInputPositiveOutputFalse3() { |
| 35 | + |
| 36 | + // Arrange |
| 37 | + final ZeroLong objectUnderTest = new ZeroLong(); |
| 38 | + final Object val = 1L; |
| 39 | + |
| 40 | + // Act |
| 41 | + final boolean retval = objectUnderTest.shouldOmit(val); |
| 42 | + |
| 43 | + // Assert result |
| 44 | + assertEquals(false, retval); |
| 45 | + } |
| 46 | + |
| 47 | + public void test_shouldOmitInputZeroOutputTrue() { |
| 48 | + |
| 49 | + // Arrange |
| 50 | + final ZeroLong objectUnderTest = new ZeroLong(); |
| 51 | + final Object val = 0L; |
| 52 | + |
| 53 | + // Act |
| 54 | + final boolean retval = objectUnderTest.shouldOmit(val); |
| 55 | + |
| 56 | + // Assert result |
| 57 | + assertEquals(true, retval); |
| 58 | + } |
| 59 | + |
| 60 | + public void test_shouldOmitInputPositiveOutputFalse4() { |
| 61 | + |
| 62 | + // Arrange |
| 63 | + final ZeroShort objectUnderTest = new ZeroShort(); |
| 64 | + final Object val = (short)1; |
| 65 | + |
| 66 | + // Act |
| 67 | + final boolean retval = objectUnderTest.shouldOmit(val); |
| 68 | + |
| 69 | + // Assert result |
| 70 | + assertEquals(false, retval); |
| 71 | + } |
| 72 | + |
| 73 | + public void test_shouldOmitInputTrueOutputFalse() { |
| 74 | + |
| 75 | + // Arrange |
| 76 | + final False objectUnderTest = new False(); |
| 77 | + final Object val = true; |
| 78 | + |
| 79 | + // Act |
| 80 | + final boolean retval = objectUnderTest.shouldOmit(val); |
| 81 | + |
| 82 | + // Assert result |
| 83 | + assertEquals(false, retval); |
| 84 | + } |
| 85 | + |
| 86 | + public void test_shouldOmitInputNotNullOutputFalse() { |
| 87 | + |
| 88 | + // Arrange |
| 89 | + final ZeroChar objectUnderTest = new ZeroChar(); |
| 90 | + final Object val = '\u0001'; |
| 91 | + |
| 92 | + // Act |
| 93 | + final boolean retval = objectUnderTest.shouldOmit(val); |
| 94 | + |
| 95 | + // Assert result |
| 96 | + assertEquals(false, retval); |
| 97 | + } |
| 98 | + |
| 99 | + public void test_shouldOmitInputPositiveOutputFalse5() { |
| 100 | + |
| 101 | + // Arrange |
| 102 | + final ZeroDouble objectUnderTest = new ZeroDouble(); |
| 103 | + final Object val = 0x0.0000000000001p-1022 /* 4.94066e-324 */; |
| 104 | + |
| 105 | + // Act |
| 106 | + final boolean retval = objectUnderTest.shouldOmit(val); |
| 107 | + |
| 108 | + // Assert result |
| 109 | + assertEquals(false, retval); |
| 110 | + } |
| 111 | + |
| 112 | + public void test_shouldOmitInputZeroOutputTrue2() { |
| 113 | + |
| 114 | + // Arrange |
| 115 | + final ZeroDouble objectUnderTest = new ZeroDouble(); |
| 116 | + final Object val = 0.0; |
| 117 | + |
| 118 | + // Act |
| 119 | + final boolean retval = objectUnderTest.shouldOmit(val); |
| 120 | + |
| 121 | + // Assert result |
| 122 | + assertEquals(true, retval); |
| 123 | + } |
| 124 | + |
| 125 | + public void test_shouldOmitInputPositiveOutputFalse6() { |
| 126 | + |
| 127 | + // Arrange |
| 128 | + final ZeroFloat objectUnderTest = new ZeroFloat(); |
| 129 | + final Object val = 0x1p-149f /* 1.4013e-45 */; |
| 130 | + |
| 131 | + // Act |
| 132 | + final boolean retval = objectUnderTest.shouldOmit(val); |
| 133 | + |
| 134 | + // Assert result |
| 135 | + assertEquals(false, retval); |
| 136 | + } |
| 137 | +} |
0 commit comments