private static String fitSymbolForNull() { final String k = "somerandomvaluetogettherepresentationofnull-1234567890"; Fixture.setSymbol(k, null); return Fixture.getSymbol(k).toString(); }
/** * gets a value. * * @param label the symbol * @return the value. */ @Override public String get(String label) { if (Fixture.hasSymbol(label)) { return Fixture.getSymbol(label).toString(); } return null; }
private String getSymbolValue(String originalSymbolName) throws NoSuchSymbolException { String[] cellContent = null; String symbolName = null; String newText = null; if (originalSymbolName.contains(".")) { cellContent = StringUtils.split(originalSymbolName, '.'); symbolName= cellContent[0]; } else { symbolName = originalSymbolName; } Object symbolValue = Fixture.getSymbol(symbolName); if (symbolValue instanceof Object[]) { // cell text is element of array int arrayIndex = getIndexFromSymbolArray(cellContent); newText = (String) getSymbolArrayValue(symbolValue, arrayIndex); } else if (cellContent != null && cellContent.length == 2) { // cell text is nested object newText = (String) symbolValue; MapParameter mapValue = MapParameter.parse(newText); if (mapValue != null) { newText = mapValue.get(cellContent[1]).toString(); } } else { newText = (String) (symbolValue); } if (newText == null) { throw new NoSuchSymbolException(String.format("No value for symbol '%s' found.", originalSymbolName)); } return newText; }
String[] nestedPath = name.split("\\."); if (Fixture.hasSymbol(nestedPath[0])) { String symbolValue = (String) Fixture.getSymbol(nestedPath[0]); if (nestedPath.length > 1) { symbolValue = unmarshallParamValue(nestedPath, symbolValue).toString(); Object symbol = Fixture.getSymbol(path[0]); String valueString = ""; Object value = null; if (symbol instanceof String) { valueString = (String) Fixture.getSymbol(path[0]); if (!"null".equals(valueString)) { value = unmarshallParamValue(path, valueString);
@Override public void doCell(Fixture fixture, Parse cell) throws Exception { String symbolName = cell.text(); if (!Fixture.hasSymbol(symbolName)) fixture.exception(cell, new FitFailureException("No such symbol: " + symbolName)); else { String value = (String) Fixture.getSymbol(symbolName); if (adapter.field != null) { adapter.set(adapter.parse(value)); cell.addToBody(Fixture.gray(" = " + value)); } if (adapter.method != null) { cell.body = value; fixture.check(cell, adapter); } } } }
@Override public void doCell(Fixture fixture, Parse cell) throws Exception { String symbolName = cell.text(); if (!Fixture.hasSymbol(symbolName)) fixture.exception(cell, new FitFailureException("No such symbol: " + symbolName)); else { String value = (String) Fixture.getSymbol(symbolName); if (adapter.field != null) { adapter.set(adapter.parse(value)); cell.addToBody(Fixture.gray(" = " + value)); } if (adapter.method != null) { cell.body = value; fixture.check(cell, adapter); } } } }