Added changes as per review
This commit is contained in:
parent
67f11db211
commit
218f67ef4c
@ -10,33 +10,33 @@ public class StringToBigIntegerUnitTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenGetStringWithOutRadix_thenOK() {
|
public void whenGetStringWithOutRadix_thenOK() {
|
||||||
final String inputString = "878";
|
String inputString = "878";
|
||||||
BigInteger result = new BigInteger(inputString);
|
BigInteger result = new BigInteger(inputString);
|
||||||
assertEquals("878", result.toString());
|
assertEquals("878", result.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenGetStringWithRadix_thenOK() {
|
public void whenGetStringWithRadix_thenOK() {
|
||||||
final String inputString = "290f98";
|
String inputString = "290f98";
|
||||||
BigInteger result = new BigInteger(inputString, 16);
|
BigInteger result = new BigInteger(inputString, 16);
|
||||||
assertEquals("2690968", result.toString());
|
assertEquals("2690968", result.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test(expected = NumberFormatException.class)
|
||||||
public void whenGetStringWithOutRadix_thenThrowError() {
|
public void whenGetStringWithOutRadix_thenThrowError() {
|
||||||
final String inputString = "290f98";
|
String inputString = "290f98";
|
||||||
new BigInteger(inputString);
|
new BigInteger(inputString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test(expected = NumberFormatException.class)
|
||||||
public void whenGetStringWithRadix_thenThrowError() {
|
public void whenGetStringWithRadix_thenThrowError() {
|
||||||
final String inputString = "290f98";
|
String inputString = "290f98";
|
||||||
new BigInteger(inputString, 7);
|
new BigInteger(inputString, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenGetStringUsingByte_thenOk() {
|
public void whenGetStringUsingByte_thenOk() {
|
||||||
final String inputString = "290f98";
|
String inputString = "290f98";
|
||||||
byte[] inputStringBytes = inputString.getBytes();
|
byte[] inputStringBytes = inputString.getBytes();
|
||||||
BigInteger result = new BigInteger(inputStringBytes);
|
BigInteger result = new BigInteger(inputStringBytes);
|
||||||
assertEquals("290f98", new String(result.toByteArray()));
|
assertEquals("290f98", new String(result.toByteArray()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user