use of org.neo4j.driver.internal.value.StringValue in project neo4j by neo4j.
the class TablePlanFormatterTest method withEmptyDetails.
@Test
public void withEmptyDetails() {
Plan plan = mock(Plan.class);
Map<String, Value> args = new HashMap<String, Value>(2) {
{
put("EstimatedRows", new FloatValue(55));
put("Details", new StringValue(""));
}
};
when(plan.arguments()).thenReturn(args);
when(plan.operatorType()).thenReturn("Projection");
assertThat(tablePlanFormatter.formatPlan(plan), is(String.join(NEWLINE, "+-------------+---------+----------------+", "| Operator | Details | Estimated Rows |", "+-------------+---------+----------------+", "| +Projection | | 55 |", "+-------------+---------+----------------+", "")));
}
use of org.neo4j.driver.internal.value.StringValue in project neo4j by neo4j.
the class TablePlanFormatterTest method renderShortDetails.
@Test
public void renderShortDetails() {
Plan plan = mock(Plan.class);
Map<String, Value> args = Collections.singletonMap("Details", new StringValue("x.prop AS prop"));
when(plan.arguments()).thenReturn(args);
when(plan.operatorType()).thenReturn("Projection");
assertThat(tablePlanFormatter.formatPlan(plan), is(String.join(NEWLINE, "+-------------+----------------+", "| Operator | Details |", "+-------------+----------------+", "| +Projection | x.prop AS prop |", "+-------------+----------------+", "")));
}
use of org.neo4j.driver.internal.value.StringValue in project neo4j by neo4j.
the class TablePlanFormatterTest method renderExactMaxLengthDetails.
@Test
public void renderExactMaxLengthDetails() {
Plan plan = mock(Plan.class);
String details = stringOfLength(TablePlanFormatter.MAX_DETAILS_COLUMN_WIDTH);
Map<String, Value> args = Collections.singletonMap("Details", new StringValue(details));
when(plan.arguments()).thenReturn(args);
when(plan.operatorType()).thenReturn("Projection");
assertThat(tablePlanFormatter.formatPlan(plan), containsString("| +Projection | " + details + " |"));
}
use of org.neo4j.driver.internal.value.StringValue in project neo4j by neo4j.
the class TablePlanFormatterTest method multiLineDetails.
@Test
public void multiLineDetails() {
Plan argumentPlan = mock(Plan.class);
when(argumentPlan.arguments()).thenReturn(Collections.emptyMap());
when(argumentPlan.operatorType()).thenReturn("Argument");
Plan childPlan = mock(Plan.class);
Map<String, Value> args = Collections.singletonMap("Details", new StringValue(stringOfLength(TablePlanFormatter.MAX_DETAILS_COLUMN_WIDTH + 5)));
when(childPlan.arguments()).thenReturn(args);
when(childPlan.operatorType()).thenReturn("Expand");
doReturn(new ArrayList<Plan>() {
{
add(argumentPlan);
add(argumentPlan);
}
}).when(childPlan).children();
Plan plan = mock(Plan.class);
String details = stringOfLength(TablePlanFormatter.MAX_DETAILS_COLUMN_WIDTH + 1);
args = Collections.singletonMap("Details", new StringValue(details));
when(plan.arguments()).thenReturn(args);
when(plan.operatorType()).thenReturn("Projection");
doReturn(new ArrayList<Plan>() {
{
add(childPlan);
add(childPlan);
}
}).when(plan).children();
assertThat(tablePlanFormatter.formatPlan(plan), is(String.join(NEWLINE, "+---------------+------------------------------------------------------------------------------------------------------+", "| Operator | Details |", "+---------------+------------------------------------------------------------------------------------------------------+", "| +Projection | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |", "| | | a |", "| |\\ +------------------------------------------------------------------------------------------------------+", "| | +Expand | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |", "| | | | aaaaa |", "| | |\\ +------------------------------------------------------------------------------------------------------+", "| | | +Argument | |", "| | | +------------------------------------------------------------------------------------------------------+", "| | +Argument | |", "| | +------------------------------------------------------------------------------------------------------+", "| +Expand | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |", "| | | aaaaa |", "| |\\ +------------------------------------------------------------------------------------------------------+", "| | +Argument | |", "| | +------------------------------------------------------------------------------------------------------+", "| +Argument | |", "+---------------+------------------------------------------------------------------------------------------------------+", "")));
}
Aggregations