Remove dependencies from tests that require additional libraries#729
Remove dependencies from tests that require additional libraries#729peterbae merged 5 commits intomicrosoft:devfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #729 +/- ##
============================================
- Coverage 48.03% 47.95% -0.09%
+ Complexity 2631 2629 -2
============================================
Files 118 118
Lines 26753 26753
Branches 4493 4493
============================================
- Hits 12852 12829 -23
- Misses 11773 11801 +28
+ Partials 2128 2123 -5
Continue to review full report at Codecov.
|
| } else if (this.precision == 1) { | ||
| randomNumeric = rnd.nextInt(10); | ||
| } else { | ||
| randomNumeric = (int) Math.pow(10, this.precision - 1) + rnd.nextInt((int) (9 * Math.pow(10, this.precision - 1))); |
There was a problem hiding this comment.
can we save this to a var so we don't have to call Math.pow(10, this.precision - 1) twice?
| } else { | ||
| randomNumeric = (int) Math.pow(10, this.scale - 1) + rnd.nextInt((int) (9 * Math.pow(10, this.scale - 1))); | ||
| } | ||
|
|
There was a problem hiding this comment.
this is the same as above can we move this out to a method which generates n random digits?
| @@ -474,4 +472,11 @@ boolean passDataAsHex(int colNum) { | |||
| return (JDBCType.BINARY == getColumn(colNum).getJdbctype() || JDBCType.VARBINARY == getColumn(colNum).getJdbctype() | |||
| || JDBCType.LONGVARBINARY == getColumn(colNum).getJdbctype()); | |||
There was a problem hiding this comment.
I know this didn't get changed, but would be better if we just do getColumn(colNum).getJdbctype() once
| return new Timestamp(ThreadLocalRandom.current().nextLong(((Timestamp) minvalue).getTime(), ((Timestamp) maxvalue).getTime())); | ||
| } | ||
|
|
||
| protected int generateRandomInt(int length) { |
There was a problem hiding this comment.
comment header? (applies to other places below)
There was a problem hiding this comment.
nah we don't need it
| //Example of how this works: | ||
| // if length is 3, then we add 100 + random number between 0~899, so that we get a random number between 100~999. | ||
| int randomNumeric; | ||
| if (length <= 0) { |
There was a problem hiding this comment.
nitpicking....
we normally do (0 >= blah) etc...
There was a problem hiding this comment.
i think that's only for comparing to null (for good reasons)
| || JDBCType.LONGVARBINARY == getColumn(colNum).getJdbctype()); | ||
| } | ||
|
|
||
| private String byteArrayToHex(byte[] a) { |
Remove dependencies from tests that are from outside required libraries.
Replaced:
org.apache.commons.lang3.RandomStringUtils
org.apache.commons.codec.binary.Hex
org.apache.commons.codec.DecoderException;
And replaced with with other methods / java.util functions.