### Question:
SybaseDatabase extends AbstractDatabase { @Override public String getViewDefinition(String schemaName, String viewName) throws DatabaseException { GetViewDefinitionStatement statement = new GetViewDefinitionStatement(convertRequestedSchemaToSchema(schemaName), viewName); Executor executor = ExecutorService.getInstance().getExecutor(this); @SuppressWarnings("unchecked") List<String> definitionRows = (List<String>) executor.queryForList(statement, String.class); StringBuilder definition = new StringBuilder(); for (String d : definitionRows) { definition.append(d); } return definition.toString(); } SybaseDatabase(); String getProductName(); String getTypeName(); int getPriority(); @Override boolean supportsDDLInTransaction(); @Override Set<String> getSystemTablesAndViews(); boolean supportsInitiallyDeferrableColumns(); @Override boolean supportsSequences(); boolean isCorrectDatabaseImplementation(DatabaseConnection conn); String getDefaultDriver(String url); String getCurrentDateTimeFunction(); @Override String getDefaultCatalogName(); @Override String getConcatSql(String... values); boolean supportsTablespaces(); @Override boolean isSystemTable(String catalogName, String schemaName, String tableName); @Override boolean isSystemView(String catalogName, String schemaName, String viewName); String generateDefaultConstraintName(String tableName, String columnName); @Override String convertRequestedSchemaToCatalog(String requestedSchema); @Override String convertRequestedSchemaToSchema(String requestedSchema); @Override boolean supportsRestrictForeignKeys(); @Override String escapeDatabaseObject(String objectName); @Override String getViewDefinition(String schemaName, String viewName); @Override int getDatabaseMajorVersion(); @Override int getDatabaseMinorVersion(); @Override String escapeIndexName(String schemaName, String indexName); static final String PRODUCT_NAME; }### Answer:
@Test public void testGetViewDefinitionWhenNoRows() throws Exception { SybaseDatabase database = new SybaseDatabase(); configureExecutor(database); assertEquals("", database.getViewDefinition("dbo", "view_name")); }
@Test public void testGetViewDefinitionWhenSingleRow() throws Exception { SybaseDatabase database = new SybaseDatabase(); configureExecutor(database, "foo"); assertEquals("foo", database.getViewDefinition("dbo", "view_name")); }
@Test public void testGetViewDefinitionWhenMultipleRows() throws Exception { SybaseDatabase database = new SybaseDatabase(); configureExecutor(database, "foo", " bar", " bat"); assertEquals("foo bar bat", database.getViewDefinition("dbo", "view_name")); }