Real should indicate error in parsing

This commit is contained in:
serso
2016-04-22 21:28:26 +02:00
parent b00e02a693
commit af5bf16182
7 changed files with 56 additions and 43 deletions

View File

@@ -0,0 +1,18 @@
package org.solovyev.android.calculator.converter;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class ConverterTest {
@Test(expected = NumberFormatException.class)
public void testShouldNotParseInvalidDecNumber() throws Exception {
Converter.parse("1A", 10);
}
@Test
public void testShouldParseValidHexNumber() throws Exception {
assertEquals(26, Converter.parse("1A", 16).toLong());
}
}