-
Notifications
You must be signed in to change notification settings - Fork 35
/
AbstractNumberFieldTest.java
492 lines (405 loc) · 22.3 KB
/
AbstractNumberFieldTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
/*******************************************************************************
* Copyright (c) 2010-2015 BSI Business Systems Integration AG.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* BSI Business Systems Integration AG - initial API and implementation
******************************************************************************/
package org.eclipse.scout.rt.client.ui.form.fields.numberfield;
import static org.eclipse.scout.rt.testing.platform.util.ScoutAssert.assertComparableEquals;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
import org.eclipse.scout.rt.client.ui.valuecontainer.INumberValueContainer;
import org.eclipse.scout.rt.platform.nls.NlsLocale;
import org.eclipse.scout.rt.testing.platform.runner.PlatformTestRunner;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(PlatformTestRunner.class)
public class AbstractNumberFieldTest extends AbstractNumberField<BigDecimal> {
private static Locale ORIGINAL_LOCALE;
private static final BigDecimal DEFAULT_MIN_VALUE = new BigDecimal("-999999999999999999999999999999999999999999999999999999999999");
private static final BigDecimal DEFAULT_MAX_VALUE = new BigDecimal("999999999999999999999999999999999999999999999999999999999999");
private AtomicInteger m_displayTextChangedCounter;
private List<String> m_displayTextChangedHistory;
@Before
public void setup() {
m_displayTextChangedCounter = new AtomicInteger();
m_displayTextChangedHistory = new ArrayList<>();
addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (IValueField.PROP_DISPLAY_TEXT.equals(evt.getPropertyName())) {
m_displayTextChangedCounter.incrementAndGet();
m_displayTextChangedHistory.add((String) evt.getNewValue());
}
}
});
}
@BeforeClass
public static void setupBeforeClass() {
ORIGINAL_LOCALE = NlsLocale.getOrElse(null);
NlsLocale.set(new Locale("de", "CH"));
}
@AfterClass
public static void tearDownAfterClass() {
NlsLocale.set(ORIGINAL_LOCALE);
}
@Override
protected BigDecimal getConfiguredMinValue() {
return null;
}
@Override
protected BigDecimal getConfiguredMaxValue() {
return null;
}
@Override
protected BigDecimal getMinPossibleValue() {
return DEFAULT_MIN_VALUE;
}
@Override
protected BigDecimal getMaxPossibleValue() {
return DEFAULT_MAX_VALUE;
}
@Override
protected BigDecimal parseValueInternal(String text) {
return parseToBigDecimalInternal(text);
}
public static void assertParseToBigDecimalInternalThrowsRuntimeException(String msg, AbstractNumberField<?> field, String textValue) {
try {
field.parseToBigDecimalInternal(textValue);
fail(msg);
}
catch (RuntimeException expected) {
}
}
public static <T extends Number> void assertValidateValueInternalThrowsRuntimeException(String msg, AbstractNumberField<T> field, T rawValue) {
try {
field.validateValueInternal(rawValue);
fail(msg);
}
catch (RuntimeException expected) {
}
}
@Test
public void testParseValueSuffix() {
for (Locale locale : DecimalFormat.getAvailableLocales()) {
DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(locale);
df.applyPattern(getFormat().toPattern());
df.applyPattern("#,##0.00 SUF");
setFormat(df);
assertComparableEquals(BigDecimal.valueOf(9999), parseValueInternal("9999"));
assertComparableEquals(BigDecimal.valueOf(9999), parseValueInternal("9999 SUF"));
assertComparableEquals(BigDecimal.valueOf(9999), parseValueInternal("9999 SUF"));
assertComparableEquals(BigDecimal.valueOf(9999), parseValueInternal("9999SUF"));
df.applyPattern("#,##0.00");
setFormat(df);
assertComparableEquals(BigDecimal.valueOf(9999), parseValueInternal("9999"));
assertParseToBigDecimalInternalThrowsRuntimeException("After setting a pattern without suffix an excpetion is expected when parsing text with suffix.", this, "9999 SUF");
getFormatInternal().setPositiveSuffix(" SUF");
getFormatInternal().setNegativeSuffix(" SUF");
assertComparableEquals(BigDecimal.valueOf(9999), parseValueInternal("9999"));
assertComparableEquals(BigDecimal.valueOf(9999), parseValueInternal("9999 SUF"));
assertComparableEquals(BigDecimal.valueOf(9999), parseValueInternal("9999 SUF"));
assertComparableEquals(BigDecimal.valueOf(9999), parseValueInternal("9999SUF"));
getFormatInternal().setPositiveSuffix("");
getFormatInternal().setNegativeSuffix("");
assertComparableEquals(BigDecimal.valueOf(9999), parseValueInternal("9999"));
assertParseToBigDecimalInternalThrowsRuntimeException("After setting an empty suffix an excpetion is expected when parsing text with suffix.", this, "9999 SUF");
}
}
@Test
public void testFormatValueInternal() {
setRoundingMode(RoundingMode.HALF_EVEN);
assertEquals("12", formatValueInternal(BigDecimal.valueOf(12.5)));
setRoundingMode(RoundingMode.HALF_UP);
assertEquals("13", formatValueInternal(BigDecimal.valueOf(12.5)));
char groupingSeparator = new DecimalFormatSymbols(NlsLocale.get()).getGroupingSeparator();
assertEquals("123" + groupingSeparator + "456" + groupingSeparator + "789", formatValueInternal(BigDecimal.valueOf(123456789)));
setGroupingUsed(false);
assertEquals("123456789", formatValueInternal(BigDecimal.valueOf(123456789)));
setGroupingUsed(true);
assertEquals("123" + groupingSeparator + "456" + groupingSeparator + "789", formatValueInternal(BigDecimal.valueOf(123456789)));
}
@Test
public void testInternalFormatInstanceNotPropagated() {
setGroupingUsed(true);
P_PropertyTracker formatTracker = new P_PropertyTracker();
addPropertyChangeListener(INumberValueContainer.PROP_DECIMAL_FORMAT, formatTracker);
DecimalFormat format = getFormat();
assertNotSame("public getter should not return internal instance", getFormatInternal(), format);
assertEquals("internal instance and copy returned by public getter should be equal", getFormatInternal(), format);
}
@Test
public void testDecimalFormatHandling() {
DecimalFormat format = getFormat();
assertTrue("expected groupingUsed-property set to true as default", format.isGroupingUsed());
assertTrue("expected groupingUsed-property set to true as default", isGroupingUsed());
format.setGroupingUsed(false);
setFormat(format);
format = getFormat();
assertFalse("expected groupingUsed-property set to false after setting format", format.isGroupingUsed());
assertFalse("expected groupingUsed-property set to false after setting format", isGroupingUsed());
setGroupingUsed(true);
format = getFormat();
assertTrue("expected groupingUsed-property set to true after using convenience setter", format.isGroupingUsed());
assertTrue("expected groupingUsed-property set to true after using convenience setter", isGroupingUsed());
}
@Test
public void testLenientGrouping() {
for (Locale locale : Locale.getAvailableLocales()) {
DecimalFormat format = (DecimalFormat) DecimalFormat.getNumberInstance(locale);
setFormat(format);
// grouping
assertEquals(new BigDecimal(123123123), parseToBigDecimalInternal("123,123,123"));
assertEquals(new BigDecimal(123123123), parseToBigDecimalInternal("123’123’123"));
assertEquals(new BigDecimal(123123123), parseToBigDecimalInternal("123'123'123"));
assertEquals(new BigDecimal(123123123), parseToBigDecimalInternal("123´123´123"));
assertEquals(new BigDecimal(123123123), parseToBigDecimalInternal("123.123.123"));
assertEquals(new BigDecimal(123123123), parseToBigDecimalInternal("123 123 123"));
assertEquals(new BigDecimal(123123123), parseToBigDecimalInternal("123\u00A0123\u00A0123"));
assertParseToBigDecimalInternalThrowsRuntimeException("Parsing with unsupported grouping separator is expected to fail", this, "123~123~123");
// decimal
setRoundingMode(RoundingMode.UP);
// if the parsing doesn't throw an exception it's successful
assertEquals(new BigDecimal(123124), parseToBigDecimalInternal("123'123.123"));
assertEquals(new BigDecimal(123124), parseToBigDecimalInternal("123,123.123"));
assertEquals(new BigDecimal(123124), parseToBigDecimalInternal("123.123,123"));
assertEquals(new BigDecimal(123124), parseToBigDecimalInternal("123'123,123"));
}
}
@Test
public void testPropertySupportForFormat() {
setGroupingUsed(true);
P_PropertyTracker formatTracker = new P_PropertyTracker();
addPropertyChangeListener(INumberValueContainer.PROP_DECIMAL_FORMAT, formatTracker);
DecimalFormat oldFormat = getFormat();
setFormat(oldFormat);
assertFalse("expected tracker not to be notified, when new value is same as old value", formatTracker.m_notified);
DecimalFormat format = getFormat();
format.applyPattern("#.#");
setFormat(format);
assertTrue("expected tracker to be notified, when value changed", formatTracker.m_notified);
assertFalse("expected new setting in property change notification", ((DecimalFormat) formatTracker.m_cachedProperty).isGroupingUsed());
}
@Test
public void testPropertySupportForMinValue() {
setMinValue(BigDecimal.TEN);
P_PropertyTracker propertyTracker = new P_PropertyTracker();
addPropertyChangeListener(INumberValueContainer.PROP_MIN_VALUE, propertyTracker);
setMinValue(BigDecimal.TEN);
assertFalse("expected tracker not to be notified, when new value is same as old value", propertyTracker.m_notified);
setMinValue(BigDecimal.ONE);
assertTrue("expected tracker to be notified, when value changed", propertyTracker.m_notified);
assertComparableEquals("expected getter to return new setting", BigDecimal.ONE, getMinValue());
assertComparableEquals("expected new setting in property change notification", BigDecimal.ONE, (BigDecimal) propertyTracker.m_cachedProperty);
}
@Test
public void testPropertySupportForMaxValue() {
setMaxValue(BigDecimal.TEN);
P_PropertyTracker propertyTracker = new P_PropertyTracker();
addPropertyChangeListener(INumberValueContainer.PROP_MAX_VALUE, propertyTracker);
setMaxValue(BigDecimal.TEN);
assertFalse("expected tracker not to be notified, when new value is same as old value", propertyTracker.m_notified);
setMaxValue(BigDecimal.ONE);
assertTrue("expected tracker to be notified, when value changed", propertyTracker.m_notified);
assertComparableEquals("expected getter to return new setting", BigDecimal.ONE, getMaxValue());
assertComparableEquals("expected new setting in property change notification", BigDecimal.ONE, (BigDecimal) propertyTracker.m_cachedProperty);
}
@Test
public void testPropertySupportForGroupingUsed() {
setGroupingUsed(true);
P_PropertyTracker formatTracker = new P_PropertyTracker();
addPropertyChangeListener(INumberValueContainer.PROP_DECIMAL_FORMAT, formatTracker);
setGroupingUsed(true);
assertFalse("expected tracker not to be notified, when new value is same as old value", formatTracker.m_notified);
DecimalFormat oldFormat = getFormat();
setGroupingUsed(false);
assertTrue("expected tracker to be notified, when value changed", formatTracker.m_notified);
assertFalse("expected getter to return new setting", isGroupingUsed());
assertFalse("expected new setting in property change notification", ((DecimalFormat) formatTracker.m_cachedProperty).isGroupingUsed());
DecimalFormat newFormat = (DecimalFormat) ((DecimalFormat) formatTracker.m_cachedProperty).clone();
newFormat.setGroupingUsed(true);
assertEquals("expected no other difference in new format", oldFormat, newFormat);
}
@Test
public void testPropertySupportForRoundingMode() {
setRoundingMode(RoundingMode.HALF_UP);
P_PropertyTracker formatTracker = new P_PropertyTracker();
addPropertyChangeListener(INumberValueContainer.PROP_DECIMAL_FORMAT, formatTracker);
setRoundingMode(RoundingMode.HALF_UP);
assertFalse("expected tracker not to be notified, when new value is same as old value", formatTracker.m_notified);
DecimalFormat oldFormat = getFormat();
setRoundingMode(RoundingMode.HALF_EVEN);
assertTrue("expected tracker to be notified, when value changed", formatTracker.m_notified);
assertEquals("expected getter to return new setting", RoundingMode.HALF_EVEN, getRoundingMode());
assertEquals("expected new setting in property change notification", RoundingMode.HALF_EVEN, ((DecimalFormat) formatTracker.m_cachedProperty).getRoundingMode());
DecimalFormat newFormat = (DecimalFormat) ((DecimalFormat) formatTracker.m_cachedProperty).clone();
newFormat.setRoundingMode(RoundingMode.HALF_UP);
assertEquals("expected no other difference in new format", oldFormat, newFormat);
}
@Test
public void testSetMaxValueSmallerThanMin() {
setMinValue(BigDecimal.valueOf(42));
assertComparableEquals("expected minValue to be as set before", BigDecimal.valueOf(42), getMinValue());
setMaxValue(BigDecimal.valueOf(9));
assertComparableEquals("expected minValue to be adapted when setting maxValue to a smaller value", BigDecimal.valueOf(9), getMinValue());
}
@Test
public void testSetMinValueBiggerThanMax() {
setMaxValue(BigDecimal.valueOf(7));
assertComparableEquals("expected maxValue to be as set before", BigDecimal.valueOf(7), getMaxValue());
setMinValue(BigDecimal.valueOf(9));
assertComparableEquals("expected maxValue to be adapted when setting minValue to a bigger value", BigDecimal.valueOf(9), getMinValue());
}
public static class P_PropertyTracker implements PropertyChangeListener {
public Object m_cachedProperty;
public boolean m_notified = false;
@Override
public void propertyChange(PropertyChangeEvent evt) {
m_notified = true;
m_cachedProperty = evt.getNewValue();
}
}
@Test
public void testIsWithinNumberFormatLimits() {
for (Locale locale : Locale.getAvailableLocales()) {
DecimalFormat format = (DecimalFormat) DecimalFormat.getNumberInstance(locale);
format.setMaximumIntegerDigits(3);
format.setMaximumFractionDigits(2);
char decimalSeparator = format.getDecimalFormatSymbols().getDecimalSeparator();
assertTrue(AbstractNumberField.isWithinNumberFormatLimits(format, "123", 2, 0, null));
assertTrue(AbstractNumberField.isWithinNumberFormatLimits(format, null, 2, 0, null));
assertTrue(AbstractNumberField.isWithinNumberFormatLimits(format, null, 2, 0, ""));
assertTrue(AbstractNumberField.isWithinNumberFormatLimits(format, null, 0, 0, "123"));
assertFalse(AbstractNumberField.isWithinNumberFormatLimits(format, "123", 2, 0, "45"));
assertTrue(AbstractNumberField.isWithinNumberFormatLimits(format, "1", 1, 0, "23"));
assertFalse(AbstractNumberField.isWithinNumberFormatLimits(format, "123", 2, 0, decimalSeparator + "456"));
assertTrue(AbstractNumberField.isWithinNumberFormatLimits(format, "1", 1, 0, decimalSeparator + "23"));
assertFalse(AbstractNumberField.isWithinNumberFormatLimits(format, "123", 1, 2, "567"));
assertTrue(AbstractNumberField.isWithinNumberFormatLimits(format, "123", 1, 2, "56"));
assertFalse(AbstractNumberField.isWithinNumberFormatLimits(format, "123", 1, 2, "567" + decimalSeparator + "7"));
assertTrue(AbstractNumberField.isWithinNumberFormatLimits(format, "123", 1, 2, "56" + decimalSeparator + "78"));
}
}
@Test
public void testCreateNumberWithinFormatLimits() {
for (Locale locale : Locale.getAvailableLocales()) {
DecimalFormat format = (DecimalFormat) DecimalFormat.getNumberInstance(locale);
char decimalSeparator = format.getDecimalFormatSymbols().getDecimalSeparator();
format.setMaximumIntegerDigits(2);
format.setMaximumFractionDigits(2);
assertEquals(format("", decimalSeparator), AbstractNumberField.createNumberWithinFormatLimits(format, null, 0, 0, null));
assertEquals(format("21.12", decimalSeparator), AbstractNumberField.createNumberWithinFormatLimits(format, format("21.12", decimalSeparator), 0, 0, null));
assertEquals(format("21.12", decimalSeparator), AbstractNumberField.createNumberWithinFormatLimits(format, format("21.12", decimalSeparator), 0, 0, ""));
assertEquals(format("21.12", decimalSeparator), AbstractNumberField.createNumberWithinFormatLimits(format, null, 0, 0, format("21.12", decimalSeparator)));
assertEquals(format("21.12", decimalSeparator), AbstractNumberField.createNumberWithinFormatLimits(format, format("21.00", decimalSeparator), 3, 2, "12"));
assertEquals(format("12.98", decimalSeparator), AbstractNumberField.createNumberWithinFormatLimits(format, format("12.12", decimalSeparator), 3, 2, "987"));
assertEquals(format("12", decimalSeparator), AbstractNumberField.createNumberWithinFormatLimits(format, format("80", decimalSeparator), 0, 2, "12"));
format.setMaximumIntegerDigits(2);
format.setMaximumFractionDigits(5);
assertEquals(format("12.12345", decimalSeparator), AbstractNumberField.createNumberWithinFormatLimits(format, format("12.12", decimalSeparator), 3, 2, "123456789"));
format.setMaximumFractionDigits(2);
format.setMaximumIntegerDigits(4);
try {
AbstractNumberField.createNumberWithinFormatLimits(format, format("12.12", decimalSeparator), 0, 2, "12345");
fail("Exception should be thrown");
}
catch (RuntimeException expected) {
//okay, expected
}
try {
AbstractNumberField.createNumberWithinFormatLimits(format, null, 0, 0, "12345678.1234");
fail("Exception should be thrown");
}
catch (RuntimeException expected) {
//okay, expected
}
}
}
@Test
public void testValidateValueInternalMaxMin() {
// expect default for maxValue=getMaxPossibleValue() and minValue=getMinPossibleValue()
assertEquals("expected to pass validation", getMaxPossibleValue(), validateValueInternal(getMaxPossibleValue()));
assertEquals("expected to pass validation", getMinPossibleValue(), validateValueInternal(getMinPossibleValue()));
setMaxValue(BigDecimal.valueOf(99));
setMinValue(BigDecimal.valueOf(-99));
AbstractNumberFieldTest.assertValidateValueInternalThrowsRuntimeException("Expected an exception when parsing a string representing a too big number.", this, BigDecimal.valueOf(100));
AbstractNumberFieldTest.assertValidateValueInternalThrowsRuntimeException("Expected an exception when parsing a string representing a too small number.", this, BigDecimal.valueOf(-100));
assertEquals("expected to pass validation", BigDecimal.valueOf(99), validateValueInternal(BigDecimal.valueOf(99)));
assertEquals("expected to pass validation", BigDecimal.valueOf(-99), validateValueInternal(BigDecimal.valueOf(-99)));
}
private String format(String s, char decimalSeparator) {
return s.replace('.', decimalSeparator);
}
@Test
public void testSetMaxAndMinValueNull() {
assertEquals("expect default for maxValue=getMaxPossibleValue()", getMaxPossibleValue(), getMaxValue());
assertEquals("expect default for minValue=getMinPossibleValue()", getMinPossibleValue(), getMinValue());
setMaxValue(BigDecimal.valueOf(99));
setMinValue(BigDecimal.valueOf(-99));
assertEquals("maxValue not as set above", BigDecimal.valueOf(99), getMaxValue());
assertEquals("minValue not as set above", BigDecimal.valueOf(-99), getMinValue());
setMaxValue(null);
setMinValue(null);
assertEquals("expect default for maxValue=getMaxPossibleValue() after calling setter with null-param", getMaxPossibleValue(), getMaxValue());
assertEquals("expect default for minValue=getMinPossibleValue() after calling setter with null-param", getMinPossibleValue(), getMinValue());
}
@Test
public void testDisplayTextInitialState() throws Exception {
assertEquals("", getDisplayText());
assertEquals(0, m_displayTextChangedCounter.get());
assertArrayEquals(new String[]{}, m_displayTextChangedHistory.toArray());
}
@Test
public void testDisplayTextSameTextTwiceUnformatted() throws Exception {
getUIFacade().parseAndSetValueFromUI("12345");
assertEquals("12'345", getDisplayText());
getUIFacade().parseAndSetValueFromUI("12345"); // input does not match display text
assertEquals("12'345", getDisplayText());
assertEquals(2, m_displayTextChangedCounter.get());
assertArrayEquals(new String[]{"12'345", "12'345"}, m_displayTextChangedHistory.toArray());
}
@Test
public void testDisplayTextSameTextTwiceFormatted() throws Exception {
getUIFacade().parseAndSetValueFromUI("12'345");
assertEquals("12'345", getDisplayText());
getUIFacade().parseAndSetValueFromUI("12'345"); // input matches display text
assertEquals("12'345", getDisplayText());
assertEquals(1, m_displayTextChangedCounter.get());
assertArrayEquals(new String[]{"12'345"}, m_displayTextChangedHistory.toArray());
}
@Test
public void testDisplayTextNoValueChangeOnEmptyText() throws Exception {
getUIFacade().parseAndSetValueFromUI("123");
assertEquals("123", getDisplayText());
getUIFacade().parseAndSetValueFromUI("");
assertEquals("", getDisplayText());
getUIFacade().parseAndSetValueFromUI("");
assertEquals("", getDisplayText());
getUIFacade().parseAndSetValueFromUI(null);
assertEquals("", getDisplayText());
assertEquals(2, m_displayTextChangedCounter.get());
assertArrayEquals(new String[]{"123", ""}, m_displayTextChangedHistory.toArray());
}
}