-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more negative testing for Converter.
- Loading branch information
Showing
9 changed files
with
213 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,6 @@ | |
import java.util.concurrent.atomic.AtomicInteger; | ||
import java.util.concurrent.atomic.AtomicLong; | ||
|
||
import com.cedarsoftware.util.StringUtilities; | ||
|
||
/** | ||
* @author Kenny Partlow ([email protected]) | ||
* <br> | ||
|
@@ -118,10 +116,6 @@ static AtomicInteger toAtomicInteger(Object from, Converter converter) { | |
return new AtomicInteger(toInt(from, converter)); | ||
} | ||
|
||
static BigDecimal toBigDecimal(Object from, Converter converter) { | ||
return new BigDecimal(StringUtilities.trimToEmpty(from.toString())); | ||
} | ||
|
||
static AtomicBoolean toAtomicBoolean(Object from, Converter converter) { | ||
return new AtomicBoolean(toLong(from, converter) != 0); | ||
} | ||
|
@@ -152,10 +146,6 @@ static boolean isBigDecimalNotZero(Object from, Converter converter) { | |
return ((BigDecimal)from).compareTo(BigDecimal.ZERO) != 0; | ||
} | ||
|
||
static BigInteger toBigInteger(Object from, Converter converter) { | ||
return new BigInteger(StringUtilities.trimToEmpty(from.toString())); | ||
} | ||
|
||
/** | ||
* @param from - object that is a number to be converted to char | ||
* @param converter - instance of converter mappings to use. | ||
|
@@ -212,9 +202,6 @@ static OffsetDateTime toOffsetDateTime(Object from, Converter converter) { | |
} | ||
|
||
static Year toYear(Object from, Converter converter) { | ||
if (from instanceof Byte) { | ||
throw new IllegalArgumentException("Cannot convert Byte to Year, not enough precision."); | ||
} | ||
Number number = (Number) from; | ||
return Year.of(number.shortValue()); | ||
} | ||
|
Oops, something went wrong.