@Test public void verify() throws Exception { QueryExecutionType executionType = expected.type(); assertEquals(expected.isProfiled, executionType.isProfiled()); assertEquals( expected.requestedExecutionPlanDescription, executionType.requestedExecutionPlanDescription()); assertEquals(expected.isExplained, executionType.isExplained()); assertEquals(expected.canContainResults, executionType.canContainResults()); assertEquals(expected.canUpdateData, executionType.canUpdateData()); assertEquals(expected.canUpdateSchema, executionType.canUpdateSchema()); }
@Test public void noneOtherLikeIt() throws Exception { for (QueryExecutionType.QueryType queryType : QueryExecutionType.QueryType.values()) { for (QueryExecutionType type : new QueryExecutionType[] {query(queryType), profiled(queryType), explained(queryType)}) { // the very same object will have the same flags, as will all the explained ones... if (type != expected.type() && !(expected.type().isExplained() && type.isExplained())) { assertFalse( expected.type().toString(), expected.isProfiled == type.isProfiled() && expected.requestedExecutionPlanDescription == type.requestedExecutionPlanDescription() && expected.isExplained == type.isExplained() && expected.canContainResults == type.canContainResults() && expected.canUpdateData == type.canUpdateData() && expected.canUpdateSchema == type.canUpdateSchema()); } } } }
@Override public String toString() { StringBuilder result = new StringBuilder(type.toString()); if (convertToQuery) { result.append(" (as query)"); } String sep = ": "; for (Field field : getClass().getDeclaredFields()) { if (field.getType() == boolean.class) { boolean value; field.setAccessible(true); try { value = field.getBoolean(this); } catch (IllegalAccessException e) { throw new RuntimeException(e); } result.append(sep).append('.').append(field.getName()).append("() == ").append(value); sep = ", "; } } return result.toString(); }
public QueryExecutionType type() { return convertToQuery ? query(type.queryType()) : type; }