target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testFindPattern() { AbstractMemory sut = new MockMemory(ByteOrder.BIG_ENDIAN); sut.addMemorySource(new MockMemorySource(new byte[] { 0x0 }, 0, 0, 100)); sut .addMemorySource(new MockMemorySource(new byte[] { 0xA }, 0, 100, 100)); sut .addMemorySource(new MockMemorySource(new byte[] { 0xB }, 0, 200, 10... | public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLED) { IMemorySource wrappedSource = new CachingMemorySource(so... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... |
@Test public void testGetStreamPosition() throws Exception { AbstractMemory memory = new MockMemory(ByteOrder.BIG_ENDIAN); memory.addMemorySource(new MockMemorySource(new byte[] { (byte)0xA0}, 0, 0x10000, 0x10000)); memory.addMemorySource(new MockMemorySource(new byte[] { (byte)0xB0}, 0, 0x20000, 0x10000)); IMemoryImag... | @Override public long getStreamPosition() throws IOException { return address; } | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public long getStreamPosition() throws IOException { return address; } } | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public long getStreamPosition() throws IOException { return address; } IMemoryImageInputStream(IMemory memory, long startingAddress); } | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public long getStreamPosition() throws IOException { return address; } IMemoryImageInputStream(IMemory memory, long startingAddress); @Override int read(byte[] buffer, int offset, int length); @Override int read(); @Override long getStreamPosition(); @Ove... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public long getStreamPosition() throws IOException { return address; } IMemoryImageInputStream(IMemory memory, long startingAddress); @Override int read(byte[] buffer, int offset, int length); @Override int read(); @Override long getStreamPosition(); @Ove... |
@Test public void testSeek() throws Exception { AbstractMemory memory = new MockMemory(ByteOrder.BIG_ENDIAN); memory.addMemorySource(new MockMemorySource(new byte[] { (byte)0xA0}, 0, 0x10000, 0x10000)); memory.addMemorySource(new MockMemorySource(new byte[] { (byte)0xB0}, 0, 0x20000, 0x10000)); IMemoryImageInputStream ... | @Override public void seek(long pos) throws IOException { address = pos; } | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public void seek(long pos) throws IOException { address = pos; } } | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public void seek(long pos) throws IOException { address = pos; } IMemoryImageInputStream(IMemory memory, long startingAddress); } | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public void seek(long pos) throws IOException { address = pos; } IMemoryImageInputStream(IMemory memory, long startingAddress); @Override int read(byte[] buffer, int offset, int length); @Override int read(); @Override long getStreamPosition(); @Override ... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public void seek(long pos) throws IOException { address = pos; } IMemoryImageInputStream(IMemory memory, long startingAddress); @Override int read(byte[] buffer, int offset, int length); @Override int read(); @Override long getStreamPosition(); @Override ... |
@Test public void testEOFBlocks() throws Exception { AbstractMemory memory = new MockMemory(ByteOrder.BIG_ENDIAN); memory.addMemorySource(new MockMemorySource(new byte[] { (byte)0xDE, (byte)0xAD, (byte)0xBE, (byte)0xEF}, 0, 0x10000, 0x10000)); memory.addMemorySource(new UnbackedMemorySource(0x20000, 0x10000, "Deliberat... | @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddress() - address); } } address += read; return read; } | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... |
@Test public void testFindPatternAcrossRanges() { AbstractMemory sut = new MockMemory(ByteOrder.BIG_ENDIAN); sut.addMemorySource(new MockMemorySource(new byte[] { 0x0 }, 0, 0, 100)); sut .addMemorySource(new MockMemorySource(new byte[] { 0xA }, 0, 100, 100)); sut .addMemorySource(new MockMemorySource(new byte[] { 0xB }... | public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLED) { IMemorySource wrappedSource = new CachingMemorySource(so... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... |
@Test public void testFindPatternWithDeadSpace() { AbstractMemory sut = new MockMemory(ByteOrder.BIG_ENDIAN); sut .addMemorySource(new MockMemorySource(new byte[] { 0x0 }, 0, 0, 0x1000)); sut .addMemorySource(new UnbackedMemorySource(0x1000, 0x2000, "Dead space")); sut.addMemorySource(new MockMemorySource(new byte[] { ... | public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLED) { IMemorySource wrappedSource = new CachingMemorySource(so... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... |
@Test public void testMergeRanges() { AbstractMemory sut = new MockMemory(ByteOrder.BIG_ENDIAN); sut.addMemorySource(new MockMemorySource(new byte[] { 0x0 }, 0, 0x10000, 0x10000)); sut.addMemorySource(new MockMemorySource(new byte[] { 0x0 }, 0, 0x60000, 0x10000)); sut.addMemorySource(new MockMemorySource(new byte[] { 0... | public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLED) { IMemorySource wrappedSource = new CachingMemorySource(so... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... | AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLE... |
@Test public void testGreaterThan() { assertTrue(Addresses.greaterThan(1, 0)); assertTrue(Addresses.greaterThan(Long.MAX_VALUE, Long.MAX_VALUE - 1)); assertFalse(Addresses.greaterThan(7, 8)); assertTrue(Addresses.greaterThan(0xFFFFFFFFFFFFFFFFL, 0)); assertTrue(Addresses.greaterThan(0xFFFFFFFFFFFFFFFFL, 0xFFFFFFFFFFFFF... | public static boolean greaterThan(long a, long b) { if (signBitsSame(a, b)) { return a > b; } else { return a < b; } } | Addresses { public static boolean greaterThan(long a, long b) { if (signBitsSame(a, b)) { return a > b; } else { return a < b; } } } | Addresses { public static boolean greaterThan(long a, long b) { if (signBitsSame(a, b)) { return a > b; } else { return a < b; } } } | Addresses { public static boolean greaterThan(long a, long b) { if (signBitsSame(a, b)) { return a > b; } else { return a < b; } } static boolean greaterThan(long a, long b); static boolean greaterThanOrEqual(long a, long b); static boolean lessThan(long a, long b); static boolean lessThanOrEqual(long a, long b); } | Addresses { public static boolean greaterThan(long a, long b) { if (signBitsSame(a, b)) { return a > b; } else { return a < b; } } static boolean greaterThan(long a, long b); static boolean greaterThanOrEqual(long a, long b); static boolean lessThan(long a, long b); static boolean lessThanOrEqual(long a, long b); } |
@Test public void testLessThan() { assertFalse(Addresses.lessThan(1, 0)); assertFalse(Addresses.lessThan(Long.MAX_VALUE, Long.MAX_VALUE - 1)); assertTrue(Addresses.lessThan(7, 8)); assertFalse(Addresses.lessThan(0xFFFFFFFFFFFFFFFFL, 0)); assertFalse(Addresses .lessThan(0xFFFFFFFFFFFFFFFFL, 0xFFFFFFFFFFFFFFFEL)); assert... | public static boolean lessThan(long a, long b) { if (signBitsSame(a, b)) { return a < b; } else { return a > b; } } | Addresses { public static boolean lessThan(long a, long b) { if (signBitsSame(a, b)) { return a < b; } else { return a > b; } } } | Addresses { public static boolean lessThan(long a, long b) { if (signBitsSame(a, b)) { return a < b; } else { return a > b; } } } | Addresses { public static boolean lessThan(long a, long b) { if (signBitsSame(a, b)) { return a < b; } else { return a > b; } } static boolean greaterThan(long a, long b); static boolean greaterThanOrEqual(long a, long b); static boolean lessThan(long a, long b); static boolean lessThanOrEqual(long a, long b); } | Addresses { public static boolean lessThan(long a, long b) { if (signBitsSame(a, b)) { return a < b; } else { return a > b; } } static boolean greaterThan(long a, long b); static boolean greaterThanOrEqual(long a, long b); static boolean lessThan(long a, long b); static boolean lessThanOrEqual(long a, long b); } |
@Test public void testReadIndividualBytes() throws Exception { AbstractMemory memory = new MockMemory(ByteOrder.BIG_ENDIAN); memory.addMemorySource(new MockMemorySource(new byte[] { (byte)0xDE, (byte)0xAD, (byte)0xBE, (byte)0xEF}, 0, 0x10000, 0x10000)); IMemoryImageInputStream sut = new IMemoryImageInputStream(memory, ... | @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddress() - address); } } address += read; return read; } | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... |
@Test public void testReadBlocksOfMemory() throws Exception { AbstractMemory memory = new MockMemory(ByteOrder.BIG_ENDIAN); memory.addMemorySource(new MockMemorySource(new byte[] { (byte)0xDE, (byte)0xAD, (byte)0xBE, (byte)0xEF}, 0, 0x10000, 0x10000)); IMemoryImageInputStream sut = new IMemoryImageInputStream(memory, 0... | @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddress() - address); } } address += read; return read; } | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... |
@Test public void testReadBlocksSpanning() throws Exception { AbstractMemory memory = new MockMemory(ByteOrder.BIG_ENDIAN); memory.addMemorySource(new MockMemorySource(new byte[] { (byte)0xDE, (byte)0xAD, (byte)0xBE, (byte)0xEF}, 0, 0x10000, 0x10000)); memory.addMemorySource(new MockMemorySource(new byte[] { (byte)0xCA... | @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddress() - address); } } address += read; return read; } | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... |
@Test public void testEOFIndividualBytes() throws Exception { AbstractMemory memory = new MockMemory(ByteOrder.BIG_ENDIAN); memory.addMemorySource(new MockMemorySource(new byte[] { (byte)0xA0}, 0, 0x10000, 0x10000)); memory.addMemorySource(new UnbackedMemorySource(0x20000, 0x10000, "Deliberately not backed")); IMemoryI... | @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddress() - address); } } address += read; return read; } | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... | IMemoryImageInputStream extends ImageInputStreamImpl { @Override public int read(byte[] buffer, int offset, int length) throws IOException { int read = 0; try { read = memory.getBytesAt(address, buffer,offset,length); } catch (MemoryFault f) { if (f.getAddress() == address) { return -1; } else { read = (int)(f.getAddre... |
@Test public void testCompleteQuery() { SqlBuilder sqlBuilder = new SqlBuilder(buildEntity()); String sql = sqlBuilder.build(); String expectedSql = "COPY simple_table (column1, column2) " + "FROM STDIN WITH (ENCODING 'UTF-8', DELIMITER '\t', HEADER false)"; assertEquals(expectedSql, sql); } | public String build() { addCopyTable(); addColumnNames(); addFileConfig(); return getSql(); } | SqlBuilder { public String build() { addCopyTable(); addColumnNames(); addFileConfig(); return getSql(); } } | SqlBuilder { public String build() { addCopyTable(); addColumnNames(); addFileConfig(); return getSql(); } SqlBuilder(EntityInfo entityInfo); } | SqlBuilder { public String build() { addCopyTable(); addColumnNames(); addFileConfig(); return getSql(); } SqlBuilder(EntityInfo entityInfo); String build(); void addCopyTable(); void addColumnNames(); void addFileConfig(); String getSql(); } | SqlBuilder { public String build() { addCopyTable(); addColumnNames(); addFileConfig(); return getSql(); } SqlBuilder(EntityInfo entityInfo); String build(); void addCopyTable(); void addColumnNames(); void addFileConfig(); String getSql(); } |
@Test public void testEscapeFieldTermination() { String text = "1234\tvalue\t5678\t"; String escaped = escaper.escapeForLoadFile(text); assertEquals("1234" + ESCAPED_BY_CHAR + FIELD_TERMINATED_CHAR + "value" + ESCAPED_BY_CHAR + FIELD_TERMINATED_CHAR + "5678" + ESCAPED_BY_CHAR + FIELD_TERMINATED_CHAR, escaped); logger.i... | public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = firstEscapable... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... |
@Test public void booleanPrimitiveTest() { EntityFieldType type = getField("booleanPrimitive"); assertTrue(type.isPrimitive()); assertEquals(FieldTypeEnum.BOOLEAN, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void booleanObjectTest() { EntityFieldType type = getField("booleanObject"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.BOOLEAN, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void bytePrimitiveTest() { EntityFieldType type = getField("bytePrimitive"); assertTrue(type.isPrimitive()); assertEquals(FieldTypeEnum.BYTE, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void byteObjectTest() { EntityFieldType type = getField("byteObject"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.BYTE, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void shortPrimitiveTest() { EntityFieldType type = getField("shortPrimitive"); assertTrue(type.isPrimitive()); assertEquals(FieldTypeEnum.SHORT, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void shortObjectTest() { EntityFieldType type = getField("shortObject"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.SHORT, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void intPrimitiveTest() { EntityFieldType type = getField("intPrimitive"); assertTrue(type.isPrimitive()); assertEquals(FieldTypeEnum.INT, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void intObjectTest() { EntityFieldType type = getField("intObject"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.INT, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void longPrimitiveTest() { EntityFieldType type = getField("longPrimitive"); assertTrue(type.isPrimitive()); assertEquals(FieldTypeEnum.LONG, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void testNoEscapeNeeded() { String text = "Some text with no escape neeed"; String escaped = escaper.escapeForStdIn(text); assertEquals(text, escaped); } | public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = firstEscapableCha... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... |
@Test public void longObjectTest() { EntityFieldType type = getField("longObject"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.LONG, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void charPrimitiveTest() { EntityFieldType type = getField("charPrimitive"); assertTrue(type.isPrimitive()); assertEquals(FieldTypeEnum.CHAR, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void charObjectTest() { EntityFieldType type = getField("charObject"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.CHAR, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void floatPrimitiveTest() { EntityFieldType type = getField("floatPrimitive"); assertTrue(type.isPrimitive()); assertEquals(FieldTypeEnum.FLOAT, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void floatObjectTest() { EntityFieldType type = getField("floatObject"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.FLOAT, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void doublePrimitiveTest() { EntityFieldType type = getField("doublePrimitive"); assertTrue(type.isPrimitive()); assertEquals(FieldTypeEnum.DOUBLE, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void doubleObjectTest() { EntityFieldType type = getField("doubleObject"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.DOUBLE, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void stringTest() { EntityFieldType type = getField("string"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.STRING, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void nonAnnotatedDateTest() { EntityFieldType type = getField("nonAnnotatedDate"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.TIMESTAMP, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void dateTest() { EntityFieldType type = getField("date"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.DATE, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void testEscapeEscapedByChar() { String text = "Some text with some \\ escape char \\\\ to change"; String escaped = escaper.escapeForStdIn(text); assertEquals("Some text with some " + ESCAPED_BY_CHAR + ESCAPED_BY_CHAR + " escape char " + ESCAPED_BY_CHAR + ESCAPED_BY_CHAR + ESCAPED_BY_CHAR + ESCAPED_BY_CHA... | public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = firstEscapableCha... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... |
@Test public void timeTest() { EntityFieldType type = getField("time"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.TIME, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void timeStampTest() { EntityFieldType type = getField("timeStamp"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.TIMESTAMP, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void sqlDateTest() { EntityFieldType type = getField("sqlDate"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.DATE, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void sqlTimeTest() { EntityFieldType type = getField("sqlTime"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.TIME, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void sqlTimeStampTest() { EntityFieldType type = getField("sqlTimeStamp"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.TIMESTAMP, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void localDateTest() { EntityFieldType type = getField("localDate"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.LOCALDATE, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void localTimeTest() { EntityFieldType type = getField("localTime"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.LOCALTIME, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void localDateTimeTest() { EntityFieldType type = getField("localDateTime"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.LOCALDATETIME, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void enumUnAnnotatedTest() { EntityFieldType type = getField("enumUnAnnotated"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.ENUMORDINAL, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void enumDefaultTest() { EntityFieldType type = getField("enumDefault"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.ENUMORDINAL, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void testEscapeFieldSeparator() { String text = "1234\tvalue\t5678\t"; String escaped = escaper.escapeForStdIn(text); assertEquals("1234" + ESCAPED_BY_CHAR + FIELD_TERMINATED_CHAR + "value" + ESCAPED_BY_CHAR + FIELD_TERMINATED_CHAR + "5678" + ESCAPED_BY_CHAR + FIELD_TERMINATED_CHAR, escaped); logger.info("... | public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = firstEscapableCha... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... |
@Test public void enumOrdinalTest() { EntityFieldType type = getField("enumOrdinal"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.ENUMORDINAL, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void enumStringTest() { EntityFieldType type = getField("enumString"); assertFalse(type.isPrimitive()); assertEquals(FieldTypeEnum.ENUMSTRING, type.getFieldType()); } | public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; } else if (Byte.class... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... | FieldTypeInspector { public Optional<EntityFieldType> getFieldType(Class<?> javaType) { FieldTypeEnum value = null; if (Long.class.equals(javaType) || long.class.equals(javaType)) { value = FieldTypeEnum.LONG; } else if (Boolean.class.equals(javaType) || boolean.class.equals(javaType)) { value = FieldTypeEnum.BOOLEAN; ... |
@Test public void testEscapeLineTermination() { String text = "Some text with \nmore than one line\n"; String escaped = escaper.escapeForStdIn(text); assertEquals("Some text with " + ESCAPED_BY_CHAR + LINE_TERMINATED_CHAR + "more than one line" + ESCAPED_BY_CHAR + LINE_TERMINATED_CHAR, escaped); logger.info("FROM:"); l... | public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = firstEscapableCha... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... |
@Test public void testEscapeLineTerminationWithCarriageReturn() { String text = "Some text with \r\nmore than one line\r\n"; String escaped = escaper.escapeForStdIn(text); String expected = "Some text with " + ESCAPED_BY_CHAR + CARRIAGE_RETURN_CHAR + ESCAPED_BY_CHAR + LINE_TERMINATED_CHAR + "more than one line" + ESCAP... | public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = firstEscapableCha... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... | PgCopyEscaper { public String escapeForStdIn(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = f... |
@Test public void testCompleteQuery() { SqlBuilder sqlBuilder = new SqlBuilder(buildEntity()); String sql = sqlBuilder.build(); String expectedSql = "LOAD DATA LOCAL INFILE '' INTO TABLE simple_table " + "CHARACTER SET UTF8 FIELDS TERMINATED BY '\t' ENCLOSED BY '' " + "ESCAPED BY '\\\\' LINES TERMINATED BY '\n' STARTIN... | public String build() { addLoadDataIntoTable(); addFileConfig(); addColumnNames(); return getSql(); } | SqlBuilder { public String build() { addLoadDataIntoTable(); addFileConfig(); addColumnNames(); return getSql(); } } | SqlBuilder { public String build() { addLoadDataIntoTable(); addFileConfig(); addColumnNames(); return getSql(); } SqlBuilder(EntityInfo entityInfo); } | SqlBuilder { public String build() { addLoadDataIntoTable(); addFileConfig(); addColumnNames(); return getSql(); } SqlBuilder(EntityInfo entityInfo); String build(); void addLoadDataIntoTable(); void addFileConfig(); void addColumnNames(); String getSql(); } | SqlBuilder { public String build() { addLoadDataIntoTable(); addFileConfig(); addColumnNames(); return getSql(); } SqlBuilder(EntityInfo entityInfo); String build(); void addLoadDataIntoTable(); void addFileConfig(); void addColumnNames(); String getSql(); } |
@Test public void testNoEscapeNeeded() { String text = "Some text with no escape neeed"; String escaped = escaper.escapeForLoadFile(text); assertEquals(text, escaped); } | public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = firstEscapable... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... |
@Test public void testEscapeEscapedByChar() { String text = "Some text with some \\ escape char \\\\ to change"; String escaped = escaper.escapeForLoadFile(text); assertEquals("Some text with some " + ESCAPED_BY_CHAR + ESCAPED_BY_CHAR + " escape char " + ESCAPED_BY_CHAR + ESCAPED_BY_CHAR + ESCAPED_BY_CHAR + ESCAPED_BY_... | public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = firstEscapable... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... |
@Test public void testEscapeLineTermination() { String text = "Some text with \nmore than one line\n"; String escaped = escaper.escapeForLoadFile(text); assertEquals("Some text with " + ESCAPED_BY_CHAR + LINE_TERMINATED_CHAR + "more than one line" + ESCAPED_BY_CHAR + LINE_TERMINATED_CHAR, escaped); logger.info("FROM:")... | public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int i = firstEscapable... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... | LoadDataEscaper { public String escapeForLoadFile(String text) { if (text == null) { return null; } int firstEscapableChar = findFirstEscapableChar(text); if (firstEscapableChar == -1) { return text; } StringBuilder sb = new StringBuilder(text.substring(0, firstEscapableChar)); int textLength = text.length(); for (int ... |
@Test public void test() { final URI root1 = URI.create(INTERNAL_URI_PREFIX + "/"); assertNull("parent should be null", UriUtils.getParent(root1)); } | public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1)); } } | UriUtils { public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1));... | UriUtils { public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1));... | UriUtils { public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1));... | UriUtils { public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1));... |
@Test public void testChildOfRoot() { final URI uri = URI.create(INTERNAL_URI_PREFIX + "/test"); assertEquals("incorrect parent", URI.create(INTERNAL_URI_PREFIX + "/"), UriUtils.getParent(uri)); } | public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1)); } } | UriUtils { public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1));... | UriUtils { public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1));... | UriUtils { public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1));... | UriUtils { public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1));... |
@Test public void testGrandchildOfRoot() { final URI uri = URI.create(INTERNAL_URI_PREFIX + "/child/grandchild"); assertEquals("incorrect parent", URI.create(INTERNAL_URI_PREFIX + "/child"), UriUtils.getParent(uri)); } | public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1)); } } | UriUtils { public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1));... | UriUtils { public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1));... | UriUtils { public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1));... | UriUtils { public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.length() - 1));... |
@Test void testFilterLetters() { List<Character> characters = filterLetters(asList('a', 'b', '1')); assertThat(characters).containsExactly('a', 'b'); } | public static List<Character> filterLetters(List<Character> characters) { return characters.stream().filter(Character::isLetter).collect(toList()); } | CharacterUtils { public static List<Character> filterLetters(List<Character> characters) { return characters.stream().filter(Character::isLetter).collect(toList()); } } | CharacterUtils { public static List<Character> filterLetters(List<Character> characters) { return characters.stream().filter(Character::isLetter).collect(toList()); } private CharacterUtils(); } | CharacterUtils { public static List<Character> filterLetters(List<Character> characters) { return characters.stream().filter(Character::isLetter).collect(toList()); } private CharacterUtils(); static List<Character> collectPrintableCharactersOf(Charset charset); static List<Character> filterLetters(List<Character> cha... | CharacterUtils { public static List<Character> filterLetters(List<Character> characters) { return characters.stream().filter(Character::isLetter).collect(toList()); } private CharacterUtils(); static List<Character> collectPrintableCharactersOf(Charset charset); static List<Character> filterLetters(List<Character> cha... |
@Test void generatedValueShouldBeWithinSpecifiedRange() { BigDecimal randomValue = randomizer.getRandomValue(); assertThat(randomValue.doubleValue()).isBetween(min, max); } | @Override public BigDecimal getRandomValue() { Double delegateRandomValue = delegate.getRandomValue(); BigDecimal randomValue = new BigDecimal(delegateRandomValue); if (scale != null) { randomValue = randomValue.setScale(this.scale, this.roundingMode); } return randomValue; } | BigDecimalRangeRandomizer implements Randomizer<BigDecimal> { @Override public BigDecimal getRandomValue() { Double delegateRandomValue = delegate.getRandomValue(); BigDecimal randomValue = new BigDecimal(delegateRandomValue); if (scale != null) { randomValue = randomValue.setScale(this.scale, this.roundingMode); } ret... | BigDecimalRangeRandomizer implements Randomizer<BigDecimal> { @Override public BigDecimal getRandomValue() { Double delegateRandomValue = delegate.getRandomValue(); BigDecimal randomValue = new BigDecimal(delegateRandomValue); if (scale != null) { randomValue = randomValue.setScale(this.scale, this.roundingMode); } ret... | BigDecimalRangeRandomizer implements Randomizer<BigDecimal> { @Override public BigDecimal getRandomValue() { Double delegateRandomValue = delegate.getRandomValue(); BigDecimal randomValue = new BigDecimal(delegateRandomValue); if (scale != null) { randomValue = randomValue.setScale(this.scale, this.roundingMode); } ret... | BigDecimalRangeRandomizer implements Randomizer<BigDecimal> { @Override public BigDecimal getRandomValue() { Double delegateRandomValue = delegate.getRandomValue(); BigDecimal randomValue = new BigDecimal(delegateRandomValue); if (scale != null) { randomValue = randomValue.setScale(this.scale, this.roundingMode); } ret... |
@Test void whenSpecifiedMinValueIsAfterMaxValueThenThrowIllegalArgumentException() { assertThatThrownBy(() -> aNewBigDecimalRangeRandomizer(max, min)).isInstanceOf(IllegalArgumentException.class); } | public static BigDecimalRangeRandomizer aNewBigDecimalRangeRandomizer(final Double min, final Double max) { return new BigDecimalRangeRandomizer(min, max); } | BigDecimalRangeRandomizer implements Randomizer<BigDecimal> { public static BigDecimalRangeRandomizer aNewBigDecimalRangeRandomizer(final Double min, final Double max) { return new BigDecimalRangeRandomizer(min, max); } } | BigDecimalRangeRandomizer implements Randomizer<BigDecimal> { public static BigDecimalRangeRandomizer aNewBigDecimalRangeRandomizer(final Double min, final Double max) { return new BigDecimalRangeRandomizer(min, max); } BigDecimalRangeRandomizer(final Double min, final Double max); BigDecimalRangeRandomizer(final Doub... | BigDecimalRangeRandomizer implements Randomizer<BigDecimal> { public static BigDecimalRangeRandomizer aNewBigDecimalRangeRandomizer(final Double min, final Double max) { return new BigDecimalRangeRandomizer(min, max); } BigDecimalRangeRandomizer(final Double min, final Double max); BigDecimalRangeRandomizer(final Doub... | BigDecimalRangeRandomizer implements Randomizer<BigDecimal> { public static BigDecimalRangeRandomizer aNewBigDecimalRangeRandomizer(final Double min, final Double max) { return new BigDecimalRangeRandomizer(min, max); } BigDecimalRangeRandomizer(final Double min, final Double max); BigDecimalRangeRandomizer(final Doub... |
@Test void generatedValueShouldBeWithinSpecifiedRange() { Float randomValue = randomizer.getRandomValue(); assertThat(randomValue).isBetween(min, max); } | @Override public Float getRandomValue() { return (float) nextDouble(min, max); } | FloatRangeRandomizer extends AbstractRangeRandomizer<Float> { @Override public Float getRandomValue() { return (float) nextDouble(min, max); } } | FloatRangeRandomizer extends AbstractRangeRandomizer<Float> { @Override public Float getRandomValue() { return (float) nextDouble(min, max); } FloatRangeRandomizer(final Float min, final Float max); FloatRangeRandomizer(final Float min, final Float max, final long seed); } | FloatRangeRandomizer extends AbstractRangeRandomizer<Float> { @Override public Float getRandomValue() { return (float) nextDouble(min, max); } FloatRangeRandomizer(final Float min, final Float max); FloatRangeRandomizer(final Float min, final Float max, final long seed); static FloatRangeRandomizer aNewFloatRangeRando... | FloatRangeRandomizer extends AbstractRangeRandomizer<Float> { @Override public Float getRandomValue() { return (float) nextDouble(min, max); } FloatRangeRandomizer(final Float min, final Float max); FloatRangeRandomizer(final Float min, final Float max, final long seed); static FloatRangeRandomizer aNewFloatRangeRando... |
@Test void whenSpecifiedMinValueIsAfterMaxValueThenThrowIllegalArgumentException() { assertThatThrownBy(() -> aNewFloatRangeRandomizer(max, min)).isInstanceOf(IllegalArgumentException.class); } | public static FloatRangeRandomizer aNewFloatRangeRandomizer(final Float min, final Float max) { return new FloatRangeRandomizer(min, max); } | FloatRangeRandomizer extends AbstractRangeRandomizer<Float> { public static FloatRangeRandomizer aNewFloatRangeRandomizer(final Float min, final Float max) { return new FloatRangeRandomizer(min, max); } } | FloatRangeRandomizer extends AbstractRangeRandomizer<Float> { public static FloatRangeRandomizer aNewFloatRangeRandomizer(final Float min, final Float max) { return new FloatRangeRandomizer(min, max); } FloatRangeRandomizer(final Float min, final Float max); FloatRangeRandomizer(final Float min, final Float max, final... | FloatRangeRandomizer extends AbstractRangeRandomizer<Float> { public static FloatRangeRandomizer aNewFloatRangeRandomizer(final Float min, final Float max) { return new FloatRangeRandomizer(min, max); } FloatRangeRandomizer(final Float min, final Float max); FloatRangeRandomizer(final Float min, final Float max, final... | FloatRangeRandomizer extends AbstractRangeRandomizer<Float> { public static FloatRangeRandomizer aNewFloatRangeRandomizer(final Float min, final Float max) { return new FloatRangeRandomizer(min, max); } FloatRangeRandomizer(final Float min, final Float max); FloatRangeRandomizer(final Float min, final Float max, final... |
@Test void generatedZonedDateTimeShouldNotBeNull() { assertThat(randomizer.getRandomValue()).isNotNull(); } | @Override public ZonedDateTime getRandomValue() { long minSeconds = min.toEpochSecond(); long maxSeconds = max.toEpochSecond(); long seconds = (long) nextDouble(minSeconds, maxSeconds); int minNanoSeconds = min.getNano(); int maxNanoSeconds = max.getNano(); long nanoSeconds = (long) nextDouble(minNanoSeconds, maxNanoSe... | ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { @Override public ZonedDateTime getRandomValue() { long minSeconds = min.toEpochSecond(); long maxSeconds = max.toEpochSecond(); long seconds = (long) nextDouble(minSeconds, maxSeconds); int minNanoSeconds = min.getNano(); int maxNanoSeconds =... | ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { @Override public ZonedDateTime getRandomValue() { long minSeconds = min.toEpochSecond(); long maxSeconds = max.toEpochSecond(); long seconds = (long) nextDouble(minSeconds, maxSeconds); int minNanoSeconds = min.getNano(); int maxNanoSeconds =... | ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { @Override public ZonedDateTime getRandomValue() { long minSeconds = min.toEpochSecond(); long maxSeconds = max.toEpochSecond(); long seconds = (long) nextDouble(minSeconds, maxSeconds); int minNanoSeconds = min.getNano(); int maxNanoSeconds =... | ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { @Override public ZonedDateTime getRandomValue() { long minSeconds = min.toEpochSecond(); long maxSeconds = max.toEpochSecond(); long seconds = (long) nextDouble(minSeconds, maxSeconds); int minNanoSeconds = min.getNano(); int maxNanoSeconds =... |
@Test void generatedZonedDateTimeShouldBeWithinSpecifiedRange() { assertThat(randomizer.getRandomValue()).isBetween(minZonedDateTime, maxZonedDateTime); } | @Override public ZonedDateTime getRandomValue() { long minSeconds = min.toEpochSecond(); long maxSeconds = max.toEpochSecond(); long seconds = (long) nextDouble(minSeconds, maxSeconds); int minNanoSeconds = min.getNano(); int maxNanoSeconds = max.getNano(); long nanoSeconds = (long) nextDouble(minNanoSeconds, maxNanoSe... | ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { @Override public ZonedDateTime getRandomValue() { long minSeconds = min.toEpochSecond(); long maxSeconds = max.toEpochSecond(); long seconds = (long) nextDouble(minSeconds, maxSeconds); int minNanoSeconds = min.getNano(); int maxNanoSeconds =... | ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { @Override public ZonedDateTime getRandomValue() { long minSeconds = min.toEpochSecond(); long maxSeconds = max.toEpochSecond(); long seconds = (long) nextDouble(minSeconds, maxSeconds); int minNanoSeconds = min.getNano(); int maxNanoSeconds =... | ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { @Override public ZonedDateTime getRandomValue() { long minSeconds = min.toEpochSecond(); long maxSeconds = max.toEpochSecond(); long seconds = (long) nextDouble(minSeconds, maxSeconds); int minNanoSeconds = min.getNano(); int maxNanoSeconds =... | ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { @Override public ZonedDateTime getRandomValue() { long minSeconds = min.toEpochSecond(); long maxSeconds = max.toEpochSecond(); long seconds = (long) nextDouble(minSeconds, maxSeconds); int minNanoSeconds = min.getNano(); int maxNanoSeconds =... |
@Test void whenSpecifiedMinZonedDateTimeIsAfterMaxZonedDateTime_thenShouldThrowIllegalArgumentException() { assertThatThrownBy(() -> aNewZonedDateTimeRangeRandomizer(maxZonedDateTime, minZonedDateTime)).isInstanceOf(IllegalArgumentException.class); } | public static ZonedDateTimeRangeRandomizer aNewZonedDateTimeRangeRandomizer(final ZonedDateTime min, final ZonedDateTime max) { return new ZonedDateTimeRangeRandomizer(min, max); } | ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { public static ZonedDateTimeRangeRandomizer aNewZonedDateTimeRangeRandomizer(final ZonedDateTime min, final ZonedDateTime max) { return new ZonedDateTimeRangeRandomizer(min, max); } } | ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { public static ZonedDateTimeRangeRandomizer aNewZonedDateTimeRangeRandomizer(final ZonedDateTime min, final ZonedDateTime max) { return new ZonedDateTimeRangeRandomizer(min, max); } ZonedDateTimeRangeRandomizer(final ZonedDateTime min, final Z... | ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { public static ZonedDateTimeRangeRandomizer aNewZonedDateTimeRangeRandomizer(final ZonedDateTime min, final ZonedDateTime max) { return new ZonedDateTimeRangeRandomizer(min, max); } ZonedDateTimeRangeRandomizer(final ZonedDateTime min, final Z... | ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { public static ZonedDateTimeRangeRandomizer aNewZonedDateTimeRangeRandomizer(final ZonedDateTime min, final ZonedDateTime max) { return new ZonedDateTimeRangeRandomizer(min, max); } ZonedDateTimeRangeRandomizer(final ZonedDateTime min, final Z... |
@Test void generatedValueShouldBeWithinSpecifiedRange() { Short randomValue = randomizer.getRandomValue(); assertThat(randomValue).isBetween(min, max); } | @Override public Short getRandomValue() { return (short) nextDouble(min, max); } | ShortRangeRandomizer extends AbstractRangeRandomizer<Short> { @Override public Short getRandomValue() { return (short) nextDouble(min, max); } } | ShortRangeRandomizer extends AbstractRangeRandomizer<Short> { @Override public Short getRandomValue() { return (short) nextDouble(min, max); } ShortRangeRandomizer(final Short min, final Short max); ShortRangeRandomizer(final Short min, final Short max, final long seed); } | ShortRangeRandomizer extends AbstractRangeRandomizer<Short> { @Override public Short getRandomValue() { return (short) nextDouble(min, max); } ShortRangeRandomizer(final Short min, final Short max); ShortRangeRandomizer(final Short min, final Short max, final long seed); static ShortRangeRandomizer aNewShortRangeRando... | ShortRangeRandomizer extends AbstractRangeRandomizer<Short> { @Override public Short getRandomValue() { return (short) nextDouble(min, max); } ShortRangeRandomizer(final Short min, final Short max); ShortRangeRandomizer(final Short min, final Short max, final long seed); static ShortRangeRandomizer aNewShortRangeRando... |
@Test void whenSpecifiedMinValueIsAfterMaxValueThenThrowIllegalArgumentException() { assertThatThrownBy(() -> aNewShortRangeRandomizer(max, min)).isInstanceOf(IllegalArgumentException.class); } | public static ShortRangeRandomizer aNewShortRangeRandomizer(final Short min, final Short max) { return new ShortRangeRandomizer(min, max); } | ShortRangeRandomizer extends AbstractRangeRandomizer<Short> { public static ShortRangeRandomizer aNewShortRangeRandomizer(final Short min, final Short max) { return new ShortRangeRandomizer(min, max); } } | ShortRangeRandomizer extends AbstractRangeRandomizer<Short> { public static ShortRangeRandomizer aNewShortRangeRandomizer(final Short min, final Short max) { return new ShortRangeRandomizer(min, max); } ShortRangeRandomizer(final Short min, final Short max); ShortRangeRandomizer(final Short min, final Short max, final... | ShortRangeRandomizer extends AbstractRangeRandomizer<Short> { public static ShortRangeRandomizer aNewShortRangeRandomizer(final Short min, final Short max) { return new ShortRangeRandomizer(min, max); } ShortRangeRandomizer(final Short min, final Short max); ShortRangeRandomizer(final Short min, final Short max, final... | ShortRangeRandomizer extends AbstractRangeRandomizer<Short> { public static ShortRangeRandomizer aNewShortRangeRandomizer(final Short min, final Short max) { return new ShortRangeRandomizer(min, max); } ShortRangeRandomizer(final Short min, final Short max); ShortRangeRandomizer(final Short min, final Short max, final... |
@Test void generatedValueMustNotBeNull() { assertThat(randomizer.getRandomValue()).isNotNull(); } | @Override public String getRandomValue() { int length = (int) nextDouble(minLength, maxLength); char[] chars = new char[length]; for (int i = 0; i < length; i++) { chars[i] = characterRandomizer.getRandomValue(); } return new String(chars); } | StringRandomizer extends AbstractRandomizer<String> { @Override public String getRandomValue() { int length = (int) nextDouble(minLength, maxLength); char[] chars = new char[length]; for (int i = 0; i < length; i++) { chars[i] = characterRandomizer.getRandomValue(); } return new String(chars); } } | StringRandomizer extends AbstractRandomizer<String> { @Override public String getRandomValue() { int length = (int) nextDouble(minLength, maxLength); char[] chars = new char[length]; for (int i = 0; i < length; i++) { chars[i] = characterRandomizer.getRandomValue(); } return new String(chars); } StringRandomizer(); St... | StringRandomizer extends AbstractRandomizer<String> { @Override public String getRandomValue() { int length = (int) nextDouble(minLength, maxLength); char[] chars = new char[length]; for (int i = 0; i < length; i++) { chars[i] = characterRandomizer.getRandomValue(); } return new String(chars); } StringRandomizer(); St... | StringRandomizer extends AbstractRandomizer<String> { @Override public String getRandomValue() { int length = (int) nextDouble(minLength, maxLength); char[] chars = new char[length]; for (int i = 0; i < length; i++) { chars[i] = characterRandomizer.getRandomValue(); } return new String(chars); } StringRandomizer(); St... |
@Test void testIsMapType() { assertThat(ReflectionUtils.isMapType(CustomMap.class)).isTrue(); assertThat(ReflectionUtils.isMapType(Foo.class)).isFalse(); } | public static boolean isMapType(final Class<?> type) { return Map.class.isAssignableFrom(type); } | ReflectionUtils { public static boolean isMapType(final Class<?> type) { return Map.class.isAssignableFrom(type); } } | ReflectionUtils { public static boolean isMapType(final Class<?> type) { return Map.class.isAssignableFrom(type); } private ReflectionUtils(); } | ReflectionUtils { public static boolean isMapType(final Class<?> type) { return Map.class.isAssignableFrom(type); } private ReflectionUtils(); @SuppressWarnings("unchecked") static Randomizer<T> asRandomizer(final Supplier<T> supplier); static List<Field> getDeclaredFields(T type); static List<Field> getInheritedField... | ReflectionUtils { public static boolean isMapType(final Class<?> type) { return Map.class.isAssignableFrom(type); } private ReflectionUtils(); @SuppressWarnings("unchecked") static Randomizer<T> asRandomizer(final Supplier<T> supplier); static List<Field> getDeclaredFields(T type); static List<Field> getInheritedField... |
@Test void generatedValueShouldTheSameAs() { String actual = stringDelegatingRandomizer.getRandomValue(); assertThat(actual).isEqualTo(valueOf(object)); } | @Override public String getRandomValue() { return valueOf(delegate.getRandomValue()); } | StringDelegatingRandomizer implements Randomizer<String> { @Override public String getRandomValue() { return valueOf(delegate.getRandomValue()); } } | StringDelegatingRandomizer implements Randomizer<String> { @Override public String getRandomValue() { return valueOf(delegate.getRandomValue()); } StringDelegatingRandomizer(final Randomizer<?> delegate); } | StringDelegatingRandomizer implements Randomizer<String> { @Override public String getRandomValue() { return valueOf(delegate.getRandomValue()); } StringDelegatingRandomizer(final Randomizer<?> delegate); static StringDelegatingRandomizer aNewStringDelegatingRandomizer(final Randomizer<?> delegate); @Override String ge... | StringDelegatingRandomizer implements Randomizer<String> { @Override public String getRandomValue() { return valueOf(delegate.getRandomValue()); } StringDelegatingRandomizer(final Randomizer<?> delegate); static StringDelegatingRandomizer aNewStringDelegatingRandomizer(final Randomizer<?> delegate); @Override String ge... |
@Test void generatedValueMustNotBeNull() { assertThat(randomizer.getRandomValue()).isNotNull(); } | @Override public Character getRandomValue() { return characters.get(random.nextInt(characters.size())); } | CharacterRandomizer extends AbstractRandomizer<Character> { @Override public Character getRandomValue() { return characters.get(random.nextInt(characters.size())); } } | CharacterRandomizer extends AbstractRandomizer<Character> { @Override public Character getRandomValue() { return characters.get(random.nextInt(characters.size())); } CharacterRandomizer(); CharacterRandomizer(final Charset charset); CharacterRandomizer(final long seed); CharacterRandomizer(final Charset charset, fin... | CharacterRandomizer extends AbstractRandomizer<Character> { @Override public Character getRandomValue() { return characters.get(random.nextInt(characters.size())); } CharacterRandomizer(); CharacterRandomizer(final Charset charset); CharacterRandomizer(final long seed); CharacterRandomizer(final Charset charset, fin... | CharacterRandomizer extends AbstractRandomizer<Character> { @Override public Character getRandomValue() { return characters.get(random.nextInt(characters.size())); } CharacterRandomizer(); CharacterRandomizer(final Charset charset); CharacterRandomizer(final long seed); CharacterRandomizer(final Charset charset, fin... |
@Test void shouldGenerateOnlyAlphabeticLetters() { assertThat(randomizer.getRandomValue()).isBetween('A', 'z'); } | @Override public Character getRandomValue() { return characters.get(random.nextInt(characters.size())); } | CharacterRandomizer extends AbstractRandomizer<Character> { @Override public Character getRandomValue() { return characters.get(random.nextInt(characters.size())); } } | CharacterRandomizer extends AbstractRandomizer<Character> { @Override public Character getRandomValue() { return characters.get(random.nextInt(characters.size())); } CharacterRandomizer(); CharacterRandomizer(final Charset charset); CharacterRandomizer(final long seed); CharacterRandomizer(final Charset charset, fin... | CharacterRandomizer extends AbstractRandomizer<Character> { @Override public Character getRandomValue() { return characters.get(random.nextInt(characters.size())); } CharacterRandomizer(); CharacterRandomizer(final Charset charset); CharacterRandomizer(final long seed); CharacterRandomizer(final Charset charset, fin... | CharacterRandomizer extends AbstractRandomizer<Character> { @Override public Character getRandomValue() { return characters.get(random.nextInt(characters.size())); } CharacterRandomizer(); CharacterRandomizer(final Charset charset); CharacterRandomizer(final long seed); CharacterRandomizer(final Charset charset, fin... |
@Test void specifiedSizeShouldBePositive() { assertThatThrownBy(() -> aNewMapRandomizer(keyRandomizer, valueRandomizer, -3)).isInstanceOf(IllegalArgumentException.class); } | public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } | MapRandomizer implements Randomizer<Map<K, V>> { public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } } | MapRandomizer implements Randomizer<Map<K, V>> { public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } MapRandomizer(final Randomizer<K> keyRandomizer, final Rand... | MapRandomizer implements Randomizer<Map<K, V>> { public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } MapRandomizer(final Randomizer<K> keyRandomizer, final Rand... | MapRandomizer implements Randomizer<Map<K, V>> { public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } MapRandomizer(final Randomizer<K> keyRandomizer, final Rand... |
@Test void nullKeyRandomizer() { assertThatThrownBy(() -> aNewMapRandomizer(null, valueRandomizer, 3)).isInstanceOf(IllegalArgumentException.class); } | public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } | MapRandomizer implements Randomizer<Map<K, V>> { public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } } | MapRandomizer implements Randomizer<Map<K, V>> { public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } MapRandomizer(final Randomizer<K> keyRandomizer, final Rand... | MapRandomizer implements Randomizer<Map<K, V>> { public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } MapRandomizer(final Randomizer<K> keyRandomizer, final Rand... | MapRandomizer implements Randomizer<Map<K, V>> { public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } MapRandomizer(final Randomizer<K> keyRandomizer, final Rand... |
@Test void nullValueRandomizer() { assertThatThrownBy(() -> aNewMapRandomizer(keyRandomizer, null, 3)).isInstanceOf(IllegalArgumentException.class); } | public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } | MapRandomizer implements Randomizer<Map<K, V>> { public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } } | MapRandomizer implements Randomizer<Map<K, V>> { public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } MapRandomizer(final Randomizer<K> keyRandomizer, final Rand... | MapRandomizer implements Randomizer<Map<K, V>> { public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } MapRandomizer(final Randomizer<K> keyRandomizer, final Rand... | MapRandomizer implements Randomizer<Map<K, V>> { public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } MapRandomizer(final Randomizer<K> keyRandomizer, final Rand... |
@Test void generatedValueShouldNotBeNull() { assertThat(randomizer.getRandomValue()).isNotNull(); } | @Override public ZoneId getRandomValue() { List<Map.Entry<String, String>> zoneIds = new ArrayList<>(ZoneId.SHORT_IDS.entrySet()); Map.Entry<String, String> randomZoneId = zoneIds.get(random.nextInt(zoneIds.size())); return ZoneId.of(randomZoneId.getValue()); } | ZoneIdRandomizer extends AbstractRandomizer<ZoneId> { @Override public ZoneId getRandomValue() { List<Map.Entry<String, String>> zoneIds = new ArrayList<>(ZoneId.SHORT_IDS.entrySet()); Map.Entry<String, String> randomZoneId = zoneIds.get(random.nextInt(zoneIds.size())); return ZoneId.of(randomZoneId.getValue()); } } | ZoneIdRandomizer extends AbstractRandomizer<ZoneId> { @Override public ZoneId getRandomValue() { List<Map.Entry<String, String>> zoneIds = new ArrayList<>(ZoneId.SHORT_IDS.entrySet()); Map.Entry<String, String> randomZoneId = zoneIds.get(random.nextInt(zoneIds.size())); return ZoneId.of(randomZoneId.getValue()); } Zone... | ZoneIdRandomizer extends AbstractRandomizer<ZoneId> { @Override public ZoneId getRandomValue() { List<Map.Entry<String, String>> zoneIds = new ArrayList<>(ZoneId.SHORT_IDS.entrySet()); Map.Entry<String, String> randomZoneId = zoneIds.get(random.nextInt(zoneIds.size())); return ZoneId.of(randomZoneId.getValue()); } Zone... | ZoneIdRandomizer extends AbstractRandomizer<ZoneId> { @Override public ZoneId getRandomValue() { List<Map.Entry<String, String>> zoneIds = new ArrayList<>(ZoneId.SHORT_IDS.entrySet()); Map.Entry<String, String> randomZoneId = zoneIds.get(random.nextInt(zoneIds.size())); return ZoneId.of(randomZoneId.getValue()); } Zone... |
@Test void generatedValueShouldNotBeNull() { assertThat(randomizer.getRandomValue()).isNotNull(); } | @Override public TimeZone getRandomValue() { String[] timeZoneIds = TimeZone.getAvailableIDs(); return TimeZone.getTimeZone(timeZoneIds[random.nextInt(timeZoneIds.length)]); } | TimeZoneRandomizer extends AbstractRandomizer<TimeZone> { @Override public TimeZone getRandomValue() { String[] timeZoneIds = TimeZone.getAvailableIDs(); return TimeZone.getTimeZone(timeZoneIds[random.nextInt(timeZoneIds.length)]); } } | TimeZoneRandomizer extends AbstractRandomizer<TimeZone> { @Override public TimeZone getRandomValue() { String[] timeZoneIds = TimeZone.getAvailableIDs(); return TimeZone.getTimeZone(timeZoneIds[random.nextInt(timeZoneIds.length)]); } TimeZoneRandomizer(); TimeZoneRandomizer(final long seed); } | TimeZoneRandomizer extends AbstractRandomizer<TimeZone> { @Override public TimeZone getRandomValue() { String[] timeZoneIds = TimeZone.getAvailableIDs(); return TimeZone.getTimeZone(timeZoneIds[random.nextInt(timeZoneIds.length)]); } TimeZoneRandomizer(); TimeZoneRandomizer(final long seed); static TimeZoneRandomizer ... | TimeZoneRandomizer extends AbstractRandomizer<TimeZone> { @Override public TimeZone getRandomValue() { String[] timeZoneIds = TimeZone.getAvailableIDs(); return TimeZone.getTimeZone(timeZoneIds[random.nextInt(timeZoneIds.length)]); } TimeZoneRandomizer(); TimeZoneRandomizer(final long seed); static TimeZoneRandomizer ... |
@Test void getRandomArray() { when(context.getParameters()).thenReturn(new EasyRandomParameters().collectionSizeRange(INT, INT)); when(easyRandom.doPopulateBean(String.class, context)).thenReturn(STRING); String[] strings = (String[]) arrayPopulator.getRandomArray(String[].class, context); assertThat(strings).containsO... | Object getRandomArray(final Class<?> fieldType, final RandomizationContext context) { Class<?> componentType = fieldType.getComponentType(); int randomSize = getRandomArraySize(context.getParameters()); Object result = Array.newInstance(componentType, randomSize); for (int i = 0; i < randomSize; i++) { Object randomEle... | ArrayPopulator { Object getRandomArray(final Class<?> fieldType, final RandomizationContext context) { Class<?> componentType = fieldType.getComponentType(); int randomSize = getRandomArraySize(context.getParameters()); Object result = Array.newInstance(componentType, randomSize); for (int i = 0; i < randomSize; i++) {... | ArrayPopulator { Object getRandomArray(final Class<?> fieldType, final RandomizationContext context) { Class<?> componentType = fieldType.getComponentType(); int randomSize = getRandomArraySize(context.getParameters()); Object result = Array.newInstance(componentType, randomSize); for (int i = 0; i < randomSize; i++) {... | ArrayPopulator { Object getRandomArray(final Class<?> fieldType, final RandomizationContext context) { Class<?> componentType = fieldType.getComponentType(); int randomSize = getRandomArraySize(context.getParameters()); Object result = Array.newInstance(componentType, randomSize); for (int i = 0; i < randomSize; i++) {... | ArrayPopulator { Object getRandomArray(final Class<?> fieldType, final RandomizationContext context) { Class<?> componentType = fieldType.getComponentType(); int randomSize = getRandomArraySize(context.getParameters()); Object result = Array.newInstance(componentType, randomSize); for (int i = 0; i < randomSize; i++) {... |
@Test void leadingBoundaryMatcherIsRemoved() { RegularExpressionRandomizer randomizer = new RegularExpressionRandomizer("^A"); String actual = randomizer.getRandomValue(); then(actual).isEqualTo("A"); } | @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } | RegularExpressionRandomizer extends FakerBasedRandomizer<String> { @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } } | RegularExpressionRandomizer extends FakerBasedRandomizer<String> { @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } RegularExpressionRandomizer(final String regularExpression); RegularExpressionRandomizer(final String regularExpression, fin... | RegularExpressionRandomizer extends FakerBasedRandomizer<String> { @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } RegularExpressionRandomizer(final String regularExpression); RegularExpressionRandomizer(final String regularExpression, fin... | RegularExpressionRandomizer extends FakerBasedRandomizer<String> { @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } RegularExpressionRandomizer(final String regularExpression); RegularExpressionRandomizer(final String regularExpression, fin... |
@Test void testIsJdkBuiltIn() { assertThat(ReflectionUtils.isJdkBuiltIn(ArrayList.class)).isTrue(); assertThat(ReflectionUtils.isJdkBuiltIn(CustomList.class)).isFalse(); } | public static boolean isJdkBuiltIn(final Class<?> type) { return type.getName().startsWith("java.util"); } | ReflectionUtils { public static boolean isJdkBuiltIn(final Class<?> type) { return type.getName().startsWith("java.util"); } } | ReflectionUtils { public static boolean isJdkBuiltIn(final Class<?> type) { return type.getName().startsWith("java.util"); } private ReflectionUtils(); } | ReflectionUtils { public static boolean isJdkBuiltIn(final Class<?> type) { return type.getName().startsWith("java.util"); } private ReflectionUtils(); @SuppressWarnings("unchecked") static Randomizer<T> asRandomizer(final Supplier<T> supplier); static List<Field> getDeclaredFields(T type); static List<Field> getInher... | ReflectionUtils { public static boolean isJdkBuiltIn(final Class<?> type) { return type.getName().startsWith("java.util"); } private ReflectionUtils(); @SuppressWarnings("unchecked") static Randomizer<T> asRandomizer(final Supplier<T> supplier); static List<Field> getDeclaredFields(T type); static List<Field> getInher... |
@Test void tailingBoundaryMatcherIsRemoved() { RegularExpressionRandomizer randomizer = new RegularExpressionRandomizer("A$"); String actual = randomizer.getRandomValue(); then(actual).isEqualTo("A"); } | @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } | RegularExpressionRandomizer extends FakerBasedRandomizer<String> { @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } } | RegularExpressionRandomizer extends FakerBasedRandomizer<String> { @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } RegularExpressionRandomizer(final String regularExpression); RegularExpressionRandomizer(final String regularExpression, fin... | RegularExpressionRandomizer extends FakerBasedRandomizer<String> { @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } RegularExpressionRandomizer(final String regularExpression); RegularExpressionRandomizer(final String regularExpression, fin... | RegularExpressionRandomizer extends FakerBasedRandomizer<String> { @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } RegularExpressionRandomizer(final String regularExpression); RegularExpressionRandomizer(final String regularExpression, fin... |
@Test void leadingAndTailingBoundaryMatcherIsRemoved() { RegularExpressionRandomizer randomizer = new RegularExpressionRandomizer("^A$"); String actual = randomizer.getRandomValue(); then(actual).isEqualTo("A"); } | @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } | RegularExpressionRandomizer extends FakerBasedRandomizer<String> { @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } } | RegularExpressionRandomizer extends FakerBasedRandomizer<String> { @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } RegularExpressionRandomizer(final String regularExpression); RegularExpressionRandomizer(final String regularExpression, fin... | RegularExpressionRandomizer extends FakerBasedRandomizer<String> { @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } RegularExpressionRandomizer(final String regularExpression); RegularExpressionRandomizer(final String regularExpression, fin... | RegularExpressionRandomizer extends FakerBasedRandomizer<String> { @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } RegularExpressionRandomizer(final String regularExpression); RegularExpressionRandomizer(final String regularExpression, fin... |
@Test void getWrapperTypeTest() { assertThat(ReflectionUtils.getWrapperType(Byte.TYPE)).isEqualTo(Byte.class); assertThat(ReflectionUtils.getWrapperType(Short.TYPE)).isEqualTo(Short.class); assertThat(ReflectionUtils.getWrapperType(Integer.TYPE)).isEqualTo(Integer.class); assertThat(ReflectionUtils.getWrapperType(Long.... | public static Class<?> getWrapperType(Class<?> primitiveType) { for(PrimitiveEnum p : PrimitiveEnum.values()) { if(p.getType().equals(primitiveType)) { return p.getClazz(); } } return primitiveType; } | ReflectionUtils { public static Class<?> getWrapperType(Class<?> primitiveType) { for(PrimitiveEnum p : PrimitiveEnum.values()) { if(p.getType().equals(primitiveType)) { return p.getClazz(); } } return primitiveType; } } | ReflectionUtils { public static Class<?> getWrapperType(Class<?> primitiveType) { for(PrimitiveEnum p : PrimitiveEnum.values()) { if(p.getType().equals(primitiveType)) { return p.getClazz(); } } return primitiveType; } private ReflectionUtils(); } | ReflectionUtils { public static Class<?> getWrapperType(Class<?> primitiveType) { for(PrimitiveEnum p : PrimitiveEnum.values()) { if(p.getType().equals(primitiveType)) { return p.getClazz(); } } return primitiveType; } private ReflectionUtils(); @SuppressWarnings("unchecked") static Randomizer<T> asRandomizer(final Su... | ReflectionUtils { public static Class<?> getWrapperType(Class<?> primitiveType) { for(PrimitiveEnum p : PrimitiveEnum.values()) { if(p.getType().equals(primitiveType)) { return p.getClazz(); } } return primitiveType; } private ReflectionUtils(); @SuppressWarnings("unchecked") static Randomizer<T> asRandomizer(final Su... |
@Test void testIsPrimitiveFieldWithDefaultValue() throws Exception { Class<PrimitiveFieldsWithDefaultValuesBean> defaultValueClass = PrimitiveFieldsWithDefaultValuesBean.class; PrimitiveFieldsWithDefaultValuesBean defaultValueBean = new PrimitiveFieldsWithDefaultValuesBean(); assertThat(ReflectionUtils.isPrimitiveField... | public static boolean isPrimitiveFieldWithDefaultValue(final Object object, final Field field) throws IllegalAccessException { Class<?> fieldType = field.getType(); if (!fieldType.isPrimitive()) { return false; } Object fieldValue = getFieldValue(object, field); if (fieldValue == null) { return false; } if (fieldType.e... | ReflectionUtils { public static boolean isPrimitiveFieldWithDefaultValue(final Object object, final Field field) throws IllegalAccessException { Class<?> fieldType = field.getType(); if (!fieldType.isPrimitive()) { return false; } Object fieldValue = getFieldValue(object, field); if (fieldValue == null) { return false;... | ReflectionUtils { public static boolean isPrimitiveFieldWithDefaultValue(final Object object, final Field field) throws IllegalAccessException { Class<?> fieldType = field.getType(); if (!fieldType.isPrimitive()) { return false; } Object fieldValue = getFieldValue(object, field); if (fieldValue == null) { return false;... | ReflectionUtils { public static boolean isPrimitiveFieldWithDefaultValue(final Object object, final Field field) throws IllegalAccessException { Class<?> fieldType = field.getType(); if (!fieldType.isPrimitive()) { return false; } Object fieldValue = getFieldValue(object, field); if (fieldValue == null) { return false;... | ReflectionUtils { public static boolean isPrimitiveFieldWithDefaultValue(final Object object, final Field field) throws IllegalAccessException { Class<?> fieldType = field.getType(); if (!fieldType.isPrimitive()) { return false; } Object fieldValue = getFieldValue(object, field); if (fieldValue == null) { return false;... |
@Test void testGetReadMethod() throws NoSuchFieldException { assertThat(ReflectionUtils.getReadMethod(PrimitiveFieldsWithDefaultValuesBean.class.getDeclaredField("b"))).isEmpty(); final Optional<Method> readMethod = ReflectionUtils.getReadMethod(Foo.class.getDeclaredField("bar")); assertThat(readMethod).isNotNull(); as... | public static Optional<Method> getReadMethod(Field field) { String fieldName = field.getName(); Class<?> fieldClass = field.getDeclaringClass(); String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase(ENGLISH) + fieldName.substring(1); Optional<Method> getter = getPublicMethod("get" + capitalizedFieldName, ... | ReflectionUtils { public static Optional<Method> getReadMethod(Field field) { String fieldName = field.getName(); Class<?> fieldClass = field.getDeclaringClass(); String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase(ENGLISH) + fieldName.substring(1); Optional<Method> getter = getPublicMethod("get" + capi... | ReflectionUtils { public static Optional<Method> getReadMethod(Field field) { String fieldName = field.getName(); Class<?> fieldClass = field.getDeclaringClass(); String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase(ENGLISH) + fieldName.substring(1); Optional<Method> getter = getPublicMethod("get" + capi... | ReflectionUtils { public static Optional<Method> getReadMethod(Field field) { String fieldName = field.getName(); Class<?> fieldClass = field.getDeclaringClass(); String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase(ENGLISH) + fieldName.substring(1); Optional<Method> getter = getPublicMethod("get" + capi... | ReflectionUtils { public static Optional<Method> getReadMethod(Field field) { String fieldName = field.getName(); Class<?> fieldClass = field.getDeclaringClass(); String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase(ENGLISH) + fieldName.substring(1); Optional<Method> getter = getPublicMethod("get" + capi... |
@Test void testGetAnnotation() throws NoSuchFieldException { Field field = AnnotatedBean.class.getDeclaredField("fieldAnnotation"); assertThat(ReflectionUtils.getAnnotation(field, NotNull.class)).isInstanceOf(NotNull.class); field = AnnotatedBean.class.getDeclaredField("methodAnnotation"); assertThat(ReflectionUtils.ge... | public static <T extends Annotation> T getAnnotation(Field field, Class<T> annotationType) { return field.getAnnotation(annotationType) == null ? getAnnotationFromReadMethod(getReadMethod(field).orElse(null), annotationType) : field.getAnnotation(annotationType); } | ReflectionUtils { public static <T extends Annotation> T getAnnotation(Field field, Class<T> annotationType) { return field.getAnnotation(annotationType) == null ? getAnnotationFromReadMethod(getReadMethod(field).orElse(null), annotationType) : field.getAnnotation(annotationType); } } | ReflectionUtils { public static <T extends Annotation> T getAnnotation(Field field, Class<T> annotationType) { return field.getAnnotation(annotationType) == null ? getAnnotationFromReadMethod(getReadMethod(field).orElse(null), annotationType) : field.getAnnotation(annotationType); } private ReflectionUtils(); } | ReflectionUtils { public static <T extends Annotation> T getAnnotation(Field field, Class<T> annotationType) { return field.getAnnotation(annotationType) == null ? getAnnotationFromReadMethod(getReadMethod(field).orElse(null), annotationType) : field.getAnnotation(annotationType); } private ReflectionUtils(); @Suppres... | ReflectionUtils { public static <T extends Annotation> T getAnnotation(Field field, Class<T> annotationType) { return field.getAnnotation(annotationType) == null ? getAnnotationFromReadMethod(getReadMethod(field).orElse(null), annotationType) : field.getAnnotation(annotationType); } private ReflectionUtils(); @Suppres... |
@Test void testIsAnnotationPresent() throws NoSuchFieldException { Field field = AnnotatedBean.class.getDeclaredField("fieldAnnotation"); assertThat(ReflectionUtils.isAnnotationPresent(field, NotNull.class)).isTrue(); field = AnnotatedBean.class.getDeclaredField("methodAnnotation"); assertThat(ReflectionUtils.isAnnotat... | public static boolean isAnnotationPresent(Field field, Class<? extends Annotation> annotationType) { final Optional<Method> readMethod = getReadMethod(field); return field.isAnnotationPresent(annotationType) || readMethod.isPresent() && readMethod.get().isAnnotationPresent(annotationType); } | ReflectionUtils { public static boolean isAnnotationPresent(Field field, Class<? extends Annotation> annotationType) { final Optional<Method> readMethod = getReadMethod(field); return field.isAnnotationPresent(annotationType) || readMethod.isPresent() && readMethod.get().isAnnotationPresent(annotationType); } } | ReflectionUtils { public static boolean isAnnotationPresent(Field field, Class<? extends Annotation> annotationType) { final Optional<Method> readMethod = getReadMethod(field); return field.isAnnotationPresent(annotationType) || readMethod.isPresent() && readMethod.get().isAnnotationPresent(annotationType); } private ... | ReflectionUtils { public static boolean isAnnotationPresent(Field field, Class<? extends Annotation> annotationType) { final Optional<Method> readMethod = getReadMethod(field); return field.isAnnotationPresent(annotationType) || readMethod.isPresent() && readMethod.get().isAnnotationPresent(annotationType); } private ... | ReflectionUtils { public static boolean isAnnotationPresent(Field field, Class<? extends Annotation> annotationType) { final Optional<Method> readMethod = getReadMethod(field); return field.isAnnotationPresent(annotationType) || readMethod.isPresent() && readMethod.get().isAnnotationPresent(annotationType); } private ... |
@Test void testGetEmptyImplementationForCollectionInterface() { Collection<?> collection = ReflectionUtils.getEmptyImplementationForCollectionInterface(List.class); assertThat(collection).isInstanceOf(ArrayList.class).isEmpty(); } | public static Collection<?> getEmptyImplementationForCollectionInterface(final Class<?> collectionInterface) { Collection<?> collection = new ArrayList<>(); if (List.class.isAssignableFrom(collectionInterface)) { collection = new ArrayList<>(); } else if (NavigableSet.class.isAssignableFrom(collectionInterface)) { coll... | ReflectionUtils { public static Collection<?> getEmptyImplementationForCollectionInterface(final Class<?> collectionInterface) { Collection<?> collection = new ArrayList<>(); if (List.class.isAssignableFrom(collectionInterface)) { collection = new ArrayList<>(); } else if (NavigableSet.class.isAssignableFrom(collection... | ReflectionUtils { public static Collection<?> getEmptyImplementationForCollectionInterface(final Class<?> collectionInterface) { Collection<?> collection = new ArrayList<>(); if (List.class.isAssignableFrom(collectionInterface)) { collection = new ArrayList<>(); } else if (NavigableSet.class.isAssignableFrom(collection... | ReflectionUtils { public static Collection<?> getEmptyImplementationForCollectionInterface(final Class<?> collectionInterface) { Collection<?> collection = new ArrayList<>(); if (List.class.isAssignableFrom(collectionInterface)) { collection = new ArrayList<>(); } else if (NavigableSet.class.isAssignableFrom(collection... | ReflectionUtils { public static Collection<?> getEmptyImplementationForCollectionInterface(final Class<?> collectionInterface) { Collection<?> collection = new ArrayList<>(); if (List.class.isAssignableFrom(collectionInterface)) { collection = new ArrayList<>(); } else if (NavigableSet.class.isAssignableFrom(collection... |
@Test void createEmptyCollectionForArrayBlockingQueue() { Collection<?> collection = ReflectionUtils.createEmptyCollectionForType(ArrayBlockingQueue.class, INITIAL_CAPACITY); assertThat(collection).isInstanceOf(ArrayBlockingQueue.class).isEmpty(); assertThat(((ArrayBlockingQueue<?>) collection).remainingCapacity()).isE... | public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(ArrayBlockingQueue.c... | ReflectionUtils { public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(Ar... | ReflectionUtils { public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(Ar... | ReflectionUtils { public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(Ar... | ReflectionUtils { public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(Ar... |
@Test void synchronousQueueShouldBeRejected() { assertThatThrownBy(() -> ReflectionUtils.createEmptyCollectionForType(SynchronousQueue.class, INITIAL_CAPACITY)).isInstanceOf(UnsupportedOperationException.class); } | public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(ArrayBlockingQueue.c... | ReflectionUtils { public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(Ar... | ReflectionUtils { public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(Ar... | ReflectionUtils { public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(Ar... | ReflectionUtils { public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(Ar... |
@Test void testGetDeclaredFields() { BigDecimal javaVersion = new BigDecimal(System.getProperty("java.specification.version")); if (javaVersion.compareTo(new BigDecimal("12")) >= 0) { assertThat(ReflectionUtils.getDeclaredFields(Street.class)).hasSize(21); } else if (javaVersion.compareTo(new BigDecimal("9")) >= 0) { a... | public static <T> List<Field> getDeclaredFields(T type) { return new ArrayList<>(asList(type.getClass().getDeclaredFields())); } | ReflectionUtils { public static <T> List<Field> getDeclaredFields(T type) { return new ArrayList<>(asList(type.getClass().getDeclaredFields())); } } | ReflectionUtils { public static <T> List<Field> getDeclaredFields(T type) { return new ArrayList<>(asList(type.getClass().getDeclaredFields())); } private ReflectionUtils(); } | ReflectionUtils { public static <T> List<Field> getDeclaredFields(T type) { return new ArrayList<>(asList(type.getClass().getDeclaredFields())); } private ReflectionUtils(); @SuppressWarnings("unchecked") static Randomizer<T> asRandomizer(final Supplier<T> supplier); static List<Field> getDeclaredFields(T type); stati... | ReflectionUtils { public static <T> List<Field> getDeclaredFields(T type) { return new ArrayList<>(asList(type.getClass().getDeclaredFields())); } private ReflectionUtils(); @SuppressWarnings("unchecked") static Randomizer<T> asRandomizer(final Supplier<T> supplier); static List<Field> getDeclaredFields(T type); stati... |
@Test void delayQueueShouldBeRejected() { assertThatThrownBy(() -> ReflectionUtils.createEmptyCollectionForType(DelayQueue.class, INITIAL_CAPACITY)).isInstanceOf(UnsupportedOperationException.class); } | public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(ArrayBlockingQueue.c... | ReflectionUtils { public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(Ar... | ReflectionUtils { public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(Ar... | ReflectionUtils { public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(Ar... | ReflectionUtils { public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e) { if (fieldType.equals(Ar... |
@Test void getEmptyImplementationForMapInterface() { Map<?, ?> map = ReflectionUtils.getEmptyImplementationForMapInterface(SortedMap.class); assertThat(map).isInstanceOf(TreeMap.class).isEmpty(); } | public static Map<?, ?> getEmptyImplementationForMapInterface(final Class<?> mapInterface) { Map<?, ?> map = new HashMap<>(); if (ConcurrentNavigableMap.class.isAssignableFrom(mapInterface)) { map = new ConcurrentSkipListMap<>(); } else if (ConcurrentMap.class.isAssignableFrom(mapInterface)) { map = new ConcurrentHashM... | ReflectionUtils { public static Map<?, ?> getEmptyImplementationForMapInterface(final Class<?> mapInterface) { Map<?, ?> map = new HashMap<>(); if (ConcurrentNavigableMap.class.isAssignableFrom(mapInterface)) { map = new ConcurrentSkipListMap<>(); } else if (ConcurrentMap.class.isAssignableFrom(mapInterface)) { map = n... | ReflectionUtils { public static Map<?, ?> getEmptyImplementationForMapInterface(final Class<?> mapInterface) { Map<?, ?> map = new HashMap<>(); if (ConcurrentNavigableMap.class.isAssignableFrom(mapInterface)) { map = new ConcurrentSkipListMap<>(); } else if (ConcurrentMap.class.isAssignableFrom(mapInterface)) { map = n... | ReflectionUtils { public static Map<?, ?> getEmptyImplementationForMapInterface(final Class<?> mapInterface) { Map<?, ?> map = new HashMap<>(); if (ConcurrentNavigableMap.class.isAssignableFrom(mapInterface)) { map = new ConcurrentSkipListMap<>(); } else if (ConcurrentMap.class.isAssignableFrom(mapInterface)) { map = n... | ReflectionUtils { public static Map<?, ?> getEmptyImplementationForMapInterface(final Class<?> mapInterface) { Map<?, ?> map = new HashMap<>(); if (ConcurrentNavigableMap.class.isAssignableFrom(mapInterface)) { map = new ConcurrentSkipListMap<>(); } else if (ConcurrentMap.class.isAssignableFrom(mapInterface)) { map = n... |
@Test void testRandomElementOf() { String[] elements = {"foo", "bar"}; String element = CollectionUtils.randomElementOf(asList(elements)); assertThat(element).isIn(elements); } | public static <T> T randomElementOf(final List<T> list) { if (list.isEmpty()) { return null; } return list.get(nextInt(0, list.size())); } | CollectionUtils { public static <T> T randomElementOf(final List<T> list) { if (list.isEmpty()) { return null; } return list.get(nextInt(0, list.size())); } } | CollectionUtils { public static <T> T randomElementOf(final List<T> list) { if (list.isEmpty()) { return null; } return list.get(nextInt(0, list.size())); } private CollectionUtils(); } | CollectionUtils { public static <T> T randomElementOf(final List<T> list) { if (list.isEmpty()) { return null; } return list.get(nextInt(0, list.size())); } private CollectionUtils(); static T randomElementOf(final List<T> list); } | CollectionUtils { public static <T> T randomElementOf(final List<T> list) { if (list.isEmpty()) { return null; } return list.get(nextInt(0, list.size())); } private CollectionUtils(); static T randomElementOf(final List<T> list); } |
@Test void generatedBeansShouldBeCorrectlyPopulated() { Person person = easyRandom.nextObject(Person.class); validatePerson(person); } | public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); T nextObject(final Class<T> type); Stream<T> objects(final Class<T> type, final int streamSize... | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); T nextObject(final Class<T> type); Stream<T> objects(final Class<T> type, final int streamSize... |
@Test void shouldFailIfSetterInvocationFails() { EasyRandom easyRandom = new EasyRandom(); Throwable thrown = catchThrowable(() -> easyRandom.nextObject(Salary.class)); assertThat(thrown).isInstanceOf(ObjectCreationException.class) .hasMessageContaining("Unable to create a random instance of type class org.jeasy.random... | public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); T nextObject(final Class<T> type); Stream<T> objects(final Class<T> type, final int streamSize... | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); T nextObject(final Class<T> type); Stream<T> objects(final Class<T> type, final int streamSize... |
@Test void finalFieldsShouldBePopulated() { Person person = easyRandom.nextObject(Person.class); assertThat(person).isNotNull(); assertThat(person.getId()).isNotNull(); } | public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); T nextObject(final Class<T> type); Stream<T> objects(final Class<T> type, final int streamSize... | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); T nextObject(final Class<T> type); Stream<T> objects(final Class<T> type, final int streamSize... |
@Test void staticFieldsShouldNotBePopulated() { try { Human human = easyRandom.nextObject(Human.class); assertThat(human).isNotNull(); } catch (Exception e) { fail("Should be able to populate types with private static final fields.", e); } } | public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); T nextObject(final Class<T> type); Stream<T> objects(final Class<T> type, final int streamSize... | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); T nextObject(final Class<T> type); Stream<T> objects(final Class<T> type, final int streamSize... |
@Test void immutableBeansShouldBePopulated() { final ImmutableBean immutableBean = easyRandom.nextObject(ImmutableBean.class); assertThat(immutableBean).hasNoNullFieldsOrProperties(); } | public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); } | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); T nextObject(final Class<T> type); Stream<T> objects(final Class<T> type, final int streamSize... | EasyRandom extends Random { public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); } EasyRandom(); EasyRandom(final EasyRandomParameters easyRandomParameters); T nextObject(final Class<T> type); Stream<T> objects(final Class<T> type, final int streamSize... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.