@Test public void testAggregate() { CountAggregate aa = new CountAggregate(); Number num; num = aa.aggregate(null); assertNull(num); num = aa.aggregate(new Number[] {}); assertNull(num); num = aa.aggregate(MockDataSet.buildIntegerArray(new int[] {0, 0, 0})); assertEquals(3, num.intValue()); num = aa.aggregate(MockDataSet.buildIntegerArray(new int[] {-1, 0})); assertEquals(2, num.intValue()); num = aa.aggregate(MockDataSet.buildIntegerArray(new int[] {0, 0, 1, 2, 3})); assertEquals(5, num.intValue()); num = aa.aggregate(MockDataSet.buildDoubleArray(new double[] {0, 0, 0})); assertEquals(3, num.doubleValue(), 0.0); num = aa.aggregate(MockDataSet.buildDoubleArray(new double[] {-1, 1})); assertEquals(2, num.doubleValue(), 0.0); num = aa.aggregate(MockDataSet.buildDoubleArray(new double[] {0, 0, 1, 4, 5})); assertEquals(5, num.doubleValue(), 0.0); }
private void initSlider(SpinnerNumberModel model) { Number min = ((Number) model.getMinimum()); Number max = ((Number) model.getMaximum()); Number value = ((Number) model.getValue()); Number stepSizeNumber = model.getStepSize(); useWholeNumbers = stepSizeNumber instanceof Integer; if (useWholeNumbers) { slider = new JSlider(min.intValue(), max.intValue(), value.intValue()); slider.setMinorTickSpacing(stepSizeNumber.intValue()); } else { stepSize = stepSizeNumber.doubleValue(); int minimum = (int) Math.round(min.doubleValue() / stepSize); int maximum = (int) Math.round(max.doubleValue() / stepSize); int intValue = (int) Math.round(value.doubleValue() / stepSize); slider = new JSlider(minimum, maximum, intValue); slider.setMinorTickSpacing(stepSizeNumber.intValue()); } Dimension size = slider.getPreferredSize(); size = new Dimension((int) (size.getWidth() * .60), (int) size.getHeight()); slider.setPreferredSize(size); slider.setSnapToTicks(true); slider.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { updateSpinnerState(); } }); }
/* * Making sure that the user input is in range * @param1 Scanner object for input * @param2 lowerbound integer * @param3 upperbound integer * @param4 String that specifies for which attribute/field input is for * printing purposes * @param5 ValType enum that specifies whether the primitive value is * an int or double * @param6 boolean that specifies whether the input is an Enum value * @param7 boolean that specifies whether to return the value if out of * range (false) or not (true) */ public static Number makeSureValInRange( Scanner input, int lowerbound, int upperbound, String inputFor, ValType valType, boolean enumeration, boolean withinRange) { boolean valid = !withinRange; Number val = 0; while (!valid) { System.out.println(inputString(inputFor, null, StringOption.SELECT, enumeration)); val = valType == ValType.INTEGER ? input.nextInt() : input.nextDouble(); if (val.intValue() < lowerbound || val.intValue() > upperbound) { System.out.println(inputString(inputFor, null, StringOption.INCORRECT, enumeration)); } else { valid = true; } } return val; }
/** * Cast a primitive value represented by its java.lang wrapper type to the specified java.lang * wrapper type. e.g. Byte(5) to Integer(5) or Integer(5) to Byte(5) * * @param toType is the java TYPE type * @param value is the value in java.lang wrapper. value may not be null. */ static Object castWrapper(Class toType, Object value) { if (!toType.isPrimitive()) throw new InterpreterError("invalid type in castWrapper: " + toType); if (value == null) throw new InterpreterError("null value in castWrapper, guard"); if (value instanceof Boolean) { if (toType != Boolean.TYPE) throw new InterpreterError("bad wrapper cast of boolean"); else return value; } // first promote char to Number type to avoid duplicating code if (value instanceof Character) value = new Integer(((Character) value).charValue()); if (!(value instanceof Number)) throw new InterpreterError("bad type in cast"); Number number = (Number) value; if (toType == Byte.TYPE) return new Byte(number.byteValue()); if (toType == Short.TYPE) return new Short(number.shortValue()); if (toType == Character.TYPE) return new Character((char) number.intValue()); if (toType == Integer.TYPE) return new Integer(number.intValue()); if (toType == Long.TYPE) return new Long(number.longValue()); if (toType == Float.TYPE) return new Float(number.floatValue()); if (toType == Double.TYPE) return new Double(number.doubleValue()); throw new InterpreterError("error in wrapper cast"); }
public void appendToResponse(WOResponse aResponse, WOContext aContext) { try { Number b = (Number) valueForBinding("firstNameDisplay"); if (b != null) firstNameDisplay = b.intValue(); else firstNameDisplay = 2; b = (Number) valueForBinding("secondNameDisplay"); if (b != null) secondNameDisplay = b.intValue(); else secondNameDisplay = 2; } catch (ClassCastException cex) { throw new IllegalArgumentException("NameDisplay bindings should be integer"); } String request = (String) valueForBinding("searchRequest"); if (request != null) { performSearchRequest(request); } else { selection = (PersonLink) EOUtilities.localInstanceOfObject( ec, (EOEnterpriseObject) valueForBinding("selection")); // syncSelection(); } if (selection == null && Various.boolForObject(valueForBinding("showPopup"))) { selection = defaultSelectionValue(); setValueForBinding(selection, "selection"); } super.appendToResponse(aResponse, aContext); found = null; // searchMessage = null; }
/** * Constructs a new <code>IntRange</code> with the specified minimum and maximum numbers (both * inclusive). * * <p>The arguments may be passed in the order (min,max) or (max,min). The getMinimum and * getMaximum methods will return the correct values. * * @param number1 first number that defines the edge of the range, inclusive * @param number2 second number that defines the edge of the range, inclusive * @throws IllegalArgumentException if either number is <code>null</code> */ public IntRange(Number number1, Number number2) { super(); if (number1 == null || number2 == null) { throw new IllegalArgumentException("The numbers must not be null"); } int number1val = number1.intValue(); int number2val = number2.intValue(); if (number2val < number1val) { this.min = number2val; this.max = number1val; if (number2 instanceof Integer) { this.minObject = (Integer) number2; } if (number1 instanceof Integer) { this.maxObject = (Integer) number1; } } else { this.min = number1val; this.max = number2val; if (number1 instanceof Integer) { this.minObject = (Integer) number1; } if (number2 instanceof Integer) { this.maxObject = (Integer) number2; } } }
public void appendToResponse(WOResponse response, WOContext context) { // set the numberOfObjectsPerBatch Number newNumberOfObjectsPerBatch = (Number) ERXThreadStorage.valueForKey(_threadStorageKey); if (newNumberOfObjectsPerBatch != null && newNumberOfObjectsPerBatch.intValue() != displayGroup().numberOfObjectsPerBatch()) { if (displayGroup() != null) { NSArray selection = selection(); if (log.isDebugEnabled()) log.debug("Setting db # of objects per batch to " + newNumberOfObjectsPerBatch); displayGroup().setNumberOfObjectsPerBatch(newNumberOfObjectsPerBatch.intValue()); if (log.isDebugEnabled()) log.debug("The batch index is being set to : " + 1); displayGroup().setCurrentBatchIndex(1); clearSelection(selection); } Object d2wcontext = valueForBinding("d2wContext"); if (d2wcontext != null) { NSNotificationCenter.defaultCenter() .postNotification( "BatchSizeChanged", ERXConstant.integerForInt(newNumberOfObjectsPerBatch.intValue()), new NSDictionary(d2wcontext, "d2wContext")); } ERXThreadStorage.takeValueForKey(null, _threadStorageKey); } if (displayGroup() != null && !displayGroup().hasMultipleBatches()) { if (currentBatchIndex() != 0) setCurrentBatchIndex(ERXConstant.ZeroInteger); } super.appendToResponse(response, context); }
private ValidState computeCodeValidity() { final String code = this.textCode.getText().trim(); if (VariablePayeSQLElement.isForbidden(code)) return ValidState.createCached(false, "Code réservé"); // on vérifie que la variable n'existe pas déja final SQLSelect selAllCodeName = new SQLSelect(getTable().getBase()); selAllCodeName.addSelectFunctionStar("count"); selAllCodeName.setWhere(new Where(getTable().getField("CODE"), "=", code)); final int idSelected = this.getSelectedID(); if (idSelected >= SQLRow.MIN_VALID_ID) { selAllCodeName.andWhere(new Where(getTable().getField("ID"), "!=", idSelected)); } final Number rubCount = (Number) getTable().getDBSystemRoot().getDataSource().executeScalar(selAllCodeName.asString()); if (rubCount.intValue() > 0) return ValidState.createCached(false, "Code déjà attribué"); final SQLSelect selAllVarName = new SQLSelect(getTable().getBase()); final SQLTable tableVar = getTable().getTable("VARIABLE_PAYE"); selAllVarName.addSelectFunctionStar("count"); selAllVarName.setWhere(new Where(tableVar.getField("NOM"), "=", code)); final Number payVarCount = (Number) getTable().getDBSystemRoot().getDataSource().executeScalar(selAllVarName.asString()); return ValidState.createCached( payVarCount.intValue() == 0, "Code déjà attribué à une variable de paye"); }
protected String getLabel(Number label, Axis axis) { String format_string = null; switch (axis) { case Y_AXIS: format_string = getYFormat(); break; case X_AXIS: format_string = getXFormat(); break; case Y_AXIS_SECONDARY: format_string = getYSecondaryFormat(); break; } if (format_string != null) return String.format(format_string, label); String text = ""; if (label.intValue() == label.doubleValue()) { text = label.intValue() + ""; } else { text = label + ""; } return text; }
@Override protected Prompt acceptValidatedInput(ConversationContext context, Number input) { boolean found = false; for (NPC npc : choices) { if (input.intValue() == npc.getId()) { found = true; break; } } CommandSender sender = (CommandSender) context.getForWhom(); if (!found) { Messaging.sendErrorTr(sender, Messages.SELECTION_PROMPT_INVALID_CHOICE, input); return this; } NPC toSelect = CitizensAPI.getNPCRegistry().getById(input.intValue()); try { callback.run(toSelect); } catch (ServerCommandException ex) { Messaging.sendTr(sender, CommandMessages.MUST_BE_INGAME); } catch (CommandUsageException ex) { Messaging.sendError(sender, ex.getMessage()); Messaging.sendError(sender, ex.getUsage()); } catch (UnhandledCommandException ex) { ex.printStackTrace(); } catch (WrappedCommandException ex) { ex.getCause().printStackTrace(); } catch (CommandException ex) { Messaging.sendError(sender, ex.getMessage()); } catch (NumberFormatException ex) { Messaging.sendErrorTr(sender, CommandMessages.INVALID_NUMBER); } return null; }
public void serialize( Number number, JsonGenerator jsongenerator, SerializerProvider serializerprovider) throws IOException, JsonGenerationException { if (number instanceof BigDecimal) { jsongenerator.writeNumber((BigDecimal) number); return; } if (number instanceof BigInteger) { jsongenerator.writeNumber((BigInteger) number); return; } if (number instanceof Integer) { jsongenerator.writeNumber(number.intValue()); return; } if (number instanceof Long) { jsongenerator.writeNumber(number.longValue()); return; } if (number instanceof Double) { jsongenerator.writeNumber(number.doubleValue()); return; } if (number instanceof Float) { jsongenerator.writeNumber(number.floatValue()); return; } if ((number instanceof Byte) || (number instanceof Short)) { jsongenerator.writeNumber(number.intValue()); return; } else { jsongenerator.writeNumber(number.toString()); return; } }
/* * We need to coerce numbers to the tightest possible type and let the * schema coerce them to the proper */ @SuppressWarnings("unchecked") private static Object tightenNumericTypes(Object o) { if (o == null) { return null; } else if (o instanceof List) { List l = (List) o; for (int i = 0; i < l.size(); i++) l.set(i, tightenNumericTypes(l.get(i))); return l; } else if (o instanceof Map) { Map m = (Map) o; for (Map.Entry entry : (Set<Map.Entry>) m.entrySet()) m.put(entry.getKey(), tightenNumericTypes(entry.getValue())); return m; } else if (o instanceof Number) { Number n = (Number) o; if (o instanceof Integer) { if (n.intValue() < Byte.MAX_VALUE) return n.byteValue(); else if (n.intValue() < Short.MAX_VALUE) return n.shortValue(); else return n; } else if (o instanceof Double) { if (n.doubleValue() < Float.MAX_VALUE) return n.floatValue(); else return n; } else { throw new RuntimeException("Unsupported numeric type: " + o.getClass()); } } else { return o; } }
public Number compute(Number d1, Number d2) { int d2Int = d2.intValue(); if (d2Int == 0) { return null; } return d1.intValue() / d2Int; }
public static int addInt(Number n1, Number n2) { int i1 = 0; if (n1 != null) i1 = n1.intValue(); int i2 = 0; if (n2 != null) i2 = n2.intValue(); return i1 + i2; }
public static int compare(Number param, Number threshold) throws Throwable { try { int eval = 0; if (threshold instanceof Double) { eval = Double.compare(param.doubleValue(), threshold.doubleValue()); } else if (threshold instanceof Float) { eval = Float.compare(param.floatValue(), threshold.floatValue()); } else if (threshold instanceof Long) { eval = (Long.valueOf(param.longValue())).compareTo(Long.valueOf(threshold.longValue())); } else if (threshold instanceof Integer) { eval = param.intValue() > threshold.intValue() ? 1 : -1; } return eval; } catch (VirtualMachineError err) { SystemFailure.initiateFailure(err); // If this ever returns, rethrow the error. We're poisoned // now, so don't let this thread continue. throw err; } catch (Throwable e) { // Whenever you catch Error or Throwable, you must also // catch VirtualMachineError (see above). However, there is // _still_ a possibility that you are dealing with a cascading // error condition, so you also need to check to see if the JVM // is still usable: SystemFailure.checkFailure(); throw e; } }
@Override public void update(Object[] accRow, Object val) { if (val != null) { Number value = (Number) val; if (fieldType == Double.class || fieldType == Float.class) { ((DoubleSum) accRow[outPos]).update(value.doubleValue()); } else if (fieldType == Integer.class || fieldType == Byte.class || fieldType == Short.class) { value = value.longValue(); Number sum = (Number) accRow[outPos]; if (sum != null) { if (fieldType == Long.class) { value = sum.longValue() + value.longValue(); } else if (fieldType == BigInteger.class) { value = ((BigInteger) sum).add((BigInteger) value); } else if (fieldType == BigDecimal.class) { value = ((BigDecimal) sum).add((BigDecimal) value); } else { // byte, short, int value = sum.intValue() + value.intValue(); } } accRow[outPos] = value; } } }
private static Object getProperValue(Number number, Class<?> expectedClass) { Class<?> klazz = ClassUtils.wrapperToPrimitive(number.getClass()); Object value = null; // Dexlib will only ever make byte (t), int, long (l), or short (s) if (klazz == byte.class) { value = number.byteValue(); if (expectedClass == boolean.class) { value = (byte) value == 1; } } else if (klazz == short.class) { value = number.shortValue(); if (expectedClass == char.class) { value = (char) number.shortValue(); } } else if (klazz == int.class) { if (expectedClass == int.class) { value = number.intValue(); } else if (expectedClass == float.class) { value = Float.intBitsToFloat(number.intValue()); } } else if (klazz == long.class) { value = number.longValue(); if (expectedClass == long.class) { value = number.longValue(); } else if (expectedClass == double.class) { value = Double.longBitsToDouble(number.longValue()); } } return value; }
/** * Sets the divider location for the {@link JSplitPane} component and sends a {@link * PropertyChangeEvent} (with the property name {@link * AccessibleContext#ACCESSIBLE_VALUE_PROPERTY}) to all registered listeners. If the supplied * value is <code>null</code>, this method does nothing and returns <code>false</code>. * * @param value the new divider location (<code>null</code> permitted). * @return <code>true</code> if the divider location value is updated, and <code>false</code> * otherwise. */ public boolean setCurrentAccessibleValue(Number value) { if (value == null) return false; Number oldValue = getCurrentAccessibleValue(); setDividerLocation(value.intValue()); firePropertyChange( AccessibleContext.ACCESSIBLE_VALUE_PROPERTY, oldValue, new Integer(value.intValue())); return true; }
@Override public JSONRPC2Response process(final Map<String, Object> params) { try { final Number tid = HandlerUtils.<Number>fetchField(MonitoringHandler.TENANT, params, true, null); final Number dpid = HandlerUtils.<Number>fetchField(MonitoringHandler.VDPID, params, false, -1); final OVXMap map = OVXMap.getInstance(); final LinkedList<Map<String, Object>> flows = new LinkedList<Map<String, Object>>(); if (dpid.longValue() == -1) { HashMap<String, Object> res = new HashMap<String, Object>(); for (OVXSwitch vsw : map.getVirtualNetwork(tid.intValue()).getSwitches()) { flows.clear(); final Collection<OVXFlowMod> fms = vsw.getFlowTable().getFlowTable(); for (final OVXFlowMod flow : fms) { final Map<String, Object> entry = flow.toMap(); flows.add(entry); } res.put(vsw.getSwitchName(), flows.clone()); } this.resp = new JSONRPC2Response(res, 0); } else { final OVXSwitch vsw = map.getVirtualNetwork(tid.intValue()).getSwitch(dpid.longValue()); final Collection<OVXFlowMod> fms = vsw.getFlowTable().getFlowTable(); for (final OVXFlowMod flow : fms) { final Map<String, Object> entry = flow.toMap(); flows.add(entry); } this.resp = new JSONRPC2Response(flows, 0); } } catch (ClassCastException | MissingRequiredField e) { this.resp = new JSONRPC2Response( new JSONRPC2Error( JSONRPC2Error.INVALID_PARAMS.getCode(), this.cmdName() + ": Unable to fetch virtual topology : " + e.getMessage()), 0); } catch (final InvalidDPIDException e) { this.resp = new JSONRPC2Response( new JSONRPC2Error( JSONRPC2Error.INVALID_PARAMS.getCode(), this.cmdName() + ": Unable to fetch virtual topology : " + e.getMessage()), 0); } catch (NetworkMappingException e) { this.resp = new JSONRPC2Response( new JSONRPC2Error( JSONRPC2Error.INVALID_PARAMS.getCode(), this.cmdName() + ": Unable to fetch virtual topology : " + e.getMessage()), 0); } return this.resp; }
public ElementTextField setTextColor(Number textColor, Number selectedTextColor) { if (textColor != null) { this.textColor = textColor.intValue(); } if (selectedTextColor != null) { this.selectedTextColor = selectedTextColor.intValue(); } return this; }
/** * 结果如果小于0,将变成0 * * @param n1 * @param n2 * @return */ public static int sub(Number n1, Number n2) { int i1 = 0; if (n1 != null) i1 = n1.intValue(); int i2 = 0; if (n2 != null) i2 = n2.intValue(); int ret = i1 - i2; return ret; }
public void setCurrentBatchIndex(Number newValue) { if (newValue != null) { if (displayGroup() != null) { displayGroup().setCurrentBatchIndex(newValue.intValue()); if (log.isDebugEnabled()) log.debug("The batch index is being set to :" + newValue.intValue()); } } }
public ElementTextField setSelectionColor(Number selectedLineColor, Number defaultCaretColor) { if (selectedLineColor != null) { this.selectedLineColor = selectedLineColor.intValue(); } if (defaultCaretColor != null) { this.defaultCaretColor = defaultCaretColor.intValue(); } return this; }
@SuppressWarnings({"rawtypes", "unchecked"}) public void testNodeProcessingSchema(LastMatchMap oper) { CountAndLastTupleTestSink matchSink = new CountAndLastTupleTestSink(); oper.last.setSink(matchSink); oper.setKey("a"); oper.setValue(3); oper.setTypeEQ(); oper.beginWindow(0); HashMap<String, Number> input = new HashMap<String, Number>(); input.put("a", 4); input.put("b", 20); input.put("c", 1000); oper.data.process(input); input.put("a", 3); input.put("b", 20); input.put("c", 1000); oper.data.process(input); input.clear(); input.put("a", 2); oper.data.process(input); input.clear(); input.put("a", 4); input.put("b", 21); input.put("c", 1000); oper.data.process(input); input.clear(); input.put("a", 3); input.put("b", 52); input.put("c", 5); oper.data.process(input); oper.endWindow(); Assert.assertEquals("number emitted tuples", 1, matchSink.count); HashMap<String, Number> tuple = (HashMap<String, Number>) matchSink.tuple; Number aval = tuple.get("a"); Number bval = tuple.get("b"); Assert.assertEquals("Value of a was ", 3, aval.intValue()); Assert.assertEquals("Value of a was ", 52, bval.intValue()); matchSink.clear(); oper.beginWindow(0); input.clear(); input.put("a", 2); input.put("b", 20); input.put("c", 1000); oper.data.process(input); input.clear(); input.put("a", 5); oper.data.process(input); oper.endWindow(); // There should be no emit as all tuples do not match Assert.assertEquals("number emitted tuples", 0, matchSink.count); matchSink.clear(); }
public static Object virtual_calculateCompileTimeConstantValue_1587718783752756055( SNode thisNode, Object leftValue, Object rightValue) { if (leftValue instanceof Number && rightValue instanceof Number) { Number a = (Number) leftValue; Number b = (Number) rightValue; if (BinaryOperation_Behavior.call_bothShouldBeWidenedTo_6205351058571053912( MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, "jetbrains.mps.baseLanguage.structure.BinaryOperation"), Double.class, a, b)) { return a.doubleValue() < b.doubleValue(); } if (BinaryOperation_Behavior.call_bothShouldBeWidenedTo_6205351058571053912( MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, "jetbrains.mps.baseLanguage.structure.BinaryOperation"), Float.class, a, b)) { return a.floatValue() < b.floatValue(); } if (BinaryOperation_Behavior.call_bothShouldBeWidenedTo_6205351058571053912( MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, "jetbrains.mps.baseLanguage.structure.BinaryOperation"), Long.class, a, b)) { return a.longValue() < b.longValue(); } if (BinaryOperation_Behavior.call_bothShouldBeWidenedTo_6205351058571053912( MetaAdapterFactory.getConcept( 0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbdeb6fecfL, "jetbrains.mps.baseLanguage.structure.BinaryOperation"), Integer.class, a, b)) { return a.intValue() < b.intValue(); } } else if (leftValue instanceof Character && rightValue instanceof Character) { return ((Character) leftValue).charValue() < ((Character) rightValue).charValue(); } return null; }
protected Number subtractNumbers(Number nOne, Number nTwo) { assert nOne != null; assert nTwo != null; if (nOne instanceof Double || nTwo instanceof Double) { return Double.valueOf(nOne.doubleValue() - nTwo.doubleValue()); } else if (nOne instanceof Long || nTwo instanceof Long) { return Long.valueOf(nOne.longValue() - nTwo.longValue()); } else { return Integer.valueOf(nOne.intValue() - nTwo.intValue()); } }
private void assertThatElementIsBelowOpsBar(String jQueryElemSelector) { Number commentYOffset = client.getElementPositionTop("jquery=" + jQueryElemSelector); Number scrollPosition = Integer.parseInt( client.getEval("this.browserbot.getCurrentWindow().jQuery('html,body').scrollTop()"), 10); Number stalkerHeight = client.getElementHeight("jquery=#stalker.detached"); if (scrollPosition.intValue() + stalkerHeight.intValue() > commentYOffset.intValue()) { throw new RuntimeException( "Expected scroll position to be anchor element top position PLUS stalker bar height"); } }
public StatisticsBusinessGroupRow( BusinessGroupToSearch businessGroup, Number coaches, Number participants, Number waiting, Number pending) { super(businessGroup); numOfCoaches = coaches == null ? 0 : coaches.intValue(); numOfParticipants = participants == null ? 0 : participants.intValue(); numWaiting = waiting == null ? 0 : waiting.intValue(); numPending = pending == null ? 0 : pending.intValue(); }
@Test @Script @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) public void shouldAppendNodeToArray() { Number oldSize = script.getVariable("oldSize"); Number newSize = script.getVariable("newSize"); String value = script.getVariable("value"); // casts to int because ruby returns long instead of int values! assertThat(oldSize.intValue() + 1).isEqualTo(newSize.intValue()); assertThat(value).isEqualTo("Testcustomer"); }
public void testSumGivesCorrectValueWithNonLatinColumnNames() { RealmResults<NonLatinFieldNames> resultList = testRealm.where(NonLatinFieldNames.class).findAll(); Number sum = resultList.sum(FIELD_KOREAN_CHAR); // Sum of numbers 0 to M-1: (M-1)*M/2 assertEquals((TEST_DATA_SIZE - 1) * TEST_DATA_SIZE / 2, sum.intValue()); sum = resultList.sum(FIELD_GREEK_CHAR); // Sum of numbers 0 to M-1: (M-1)*M/2 assertEquals((TEST_DATA_SIZE - 1) * TEST_DATA_SIZE / 2, sum.intValue()); }