Search in sources :

Example 1 with DurationValue

use of org.neo4j.driver.internal.value.DurationValue in project neo4j by neo4j.

the class TableOutputFormatterTest method prettyPrintDurationWithNoTrailingZeroes.

@Test
public void prettyPrintDurationWithNoTrailingZeroes() {
    // given
    List<String> keys = asList("d");
    Value duration = new DurationValue(new InternalIsoDuration(1, 2, 3, 0));
    Record record = new InternalRecord(keys, new Value[] { duration });
    // when
    String actual = verbosePrinter.format(new ListBoltResult(asList(record), mock(ResultSummary.class)));
    // then
    assertThat(actual, containsString("| P1M2DT3S |"));
}
Also used : InternalRecord(org.neo4j.driver.internal.InternalRecord) ListBoltResult(org.neo4j.shell.state.ListBoltResult) DurationValue(org.neo4j.driver.internal.value.DurationValue) Value(org.neo4j.driver.Value) RelationshipValue(org.neo4j.driver.internal.value.RelationshipValue) NodeValue(org.neo4j.driver.internal.value.NodeValue) DurationValue(org.neo4j.driver.internal.value.DurationValue) PathValue(org.neo4j.driver.internal.value.PathValue) PointValue(org.neo4j.driver.internal.value.PointValue) InternalRecord(org.neo4j.driver.internal.InternalRecord) Record(org.neo4j.driver.Record) StringContains.containsString(org.hamcrest.core.StringContains.containsString) InternalIsoDuration(org.neo4j.driver.internal.InternalIsoDuration) Test(org.junit.Test)

Example 2 with DurationValue

use of org.neo4j.driver.internal.value.DurationValue in project neo4j by neo4j.

the class TableOutputFormatterTest method prettyPrintDuration.

@Test
public void prettyPrintDuration() {
    // given
    List<String> keys = asList("d");
    Value duration = new DurationValue(new InternalIsoDuration(1, 2, 3, 4));
    Record record = new InternalRecord(keys, new Value[] { duration });
    // when
    String actual = verbosePrinter.format(new ListBoltResult(asList(record), mock(ResultSummary.class)));
    // then
    assertThat(actual, containsString("| P1M2DT3.000000004S |"));
}
Also used : InternalRecord(org.neo4j.driver.internal.InternalRecord) ListBoltResult(org.neo4j.shell.state.ListBoltResult) DurationValue(org.neo4j.driver.internal.value.DurationValue) Value(org.neo4j.driver.Value) RelationshipValue(org.neo4j.driver.internal.value.RelationshipValue) NodeValue(org.neo4j.driver.internal.value.NodeValue) DurationValue(org.neo4j.driver.internal.value.DurationValue) PathValue(org.neo4j.driver.internal.value.PathValue) PointValue(org.neo4j.driver.internal.value.PointValue) InternalRecord(org.neo4j.driver.internal.InternalRecord) Record(org.neo4j.driver.Record) StringContains.containsString(org.hamcrest.core.StringContains.containsString) InternalIsoDuration(org.neo4j.driver.internal.InternalIsoDuration) Test(org.junit.Test)

Aggregations

StringContains.containsString (org.hamcrest.core.StringContains.containsString)2 Test (org.junit.Test)2 Record (org.neo4j.driver.Record)2 Value (org.neo4j.driver.Value)2 InternalIsoDuration (org.neo4j.driver.internal.InternalIsoDuration)2 InternalRecord (org.neo4j.driver.internal.InternalRecord)2 DurationValue (org.neo4j.driver.internal.value.DurationValue)2 NodeValue (org.neo4j.driver.internal.value.NodeValue)2 PathValue (org.neo4j.driver.internal.value.PathValue)2 PointValue (org.neo4j.driver.internal.value.PointValue)2 RelationshipValue (org.neo4j.driver.internal.value.RelationshipValue)2 ListBoltResult (org.neo4j.shell.state.ListBoltResult)2