use of org.odk.collect.android.widgets.support.FakeWaitingForDataRegistry in project collect by opendatakit.
the class ExDecimalWidgetTest method digitsAboveLimitOfFifteenShouldBeTruncatedFromRight.
@Test
public // This should never be possible because the EditText has a limit on it
void digitsAboveLimitOfFifteenShouldBeTruncatedFromRight() {
Double eighteenDigitDouble = 9999999999999994.;
String fifteenDigitString = "999999999999994";
assertSame(15, fifteenDigitString.length());
when(formEntryPrompt.getAnswerValue()).thenReturn(answerData);
when(answerData.getValue()).thenReturn(eighteenDigitDouble);
ExDecimalWidget exDecimalWidget = new ExDecimalWidget(activity, new QuestionDetails(formEntryPrompt), new FakeWaitingForDataRegistry(), stringRequester);
assertThat(exDecimalWidget.getAnswerText(), is(equalTo(fifteenDigitString)));
exDecimalWidget = new ExDecimalWidget(activity, new QuestionDetails(formEntryPrompt), new FakeWaitingForDataRegistry(), stringRequester);
assertThat(exDecimalWidget.getAnswerText(), is(equalTo(fifteenDigitString)));
}
Aggregations