@Test public void partialSelector() { int startIndex = 0; int endIndex = 5; final String expectedValue = A_CONTROL_FIELD_VALUE.substring(startIndex, endIndex + 1); final Document document = newRecord(A_CONTROL_FIELD_NAME, A_CONTROL_FIELD_VALUE); final String [] expressions = { A_CONTROL_FIELD_NAME + "[00-" + endIndex + "]", A_CONTROL_FIELD_NAME + " [ 00 - " + endIndex + " ]", A_CONTROL_FIELD_NAME + " [ 00 - " + endIndex + " ]"}; for (final String specs : expressions) { final ControlFieldExpression expression = new ControlFieldExpression(specs); expression.xpath = new OXPath(); assertEquals(expectedValue, expression.evaluate(document)); } }
@Override public String evaluate(final Document target) { final String result = currentState.evaluate(target); return result != null && result.trim().length() > 0 ? result : null; }
ControlFieldExpression implements Expression<String, Document> { @Override public String evaluate(final Document target) { final String result = currentState.evaluate(target); return result != null && result.trim().length() > 0 ? result : null; } }
ControlFieldExpression implements Expression<String, Document> { @Override public String evaluate(final Document target) { final String result = currentState.evaluate(target); return result != null && result.trim().length() > 0 ? result : null; } ControlFieldExpression(final String specs); }
ControlFieldExpression implements Expression<String, Document> { @Override public String evaluate(final Document target) { final String result = currentState.evaluate(target); return result != null && result.trim().length() > 0 ? result : null; } ControlFieldExpression(final String specs); @Override String evaluate(final Document target); @Override String specs(); @Override String toString(); }
ControlFieldExpression implements Expression<String, Document> { @Override public String evaluate(final Document target) { final String result = currentState.evaluate(target); return result != null && result.trim().length() > 0 ? result : null; } ControlFieldExpression(final String specs); @Override String evaluate(final Document target); @Override String specs(); @Override String toString();  }