Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.j256.ormlite.db;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.util.List;
	protected void setDatabaseParams() throws SQLException {
		 = "jdbc:db2:ormlitedb2";
	}
	protected boolean isDriverClassExpected() {
		return false;
	}
	public void testEscapedEntityName() throws Exception {
		String word = "word";
		assertEquals("\"" + word + "\"", TestUtils.appendEscapedEntityName(word));
	}
	public void testBoolean() throws Exception {
		TableInfo<AllTypesVoidtableInfo = new TableInfo<AllTypesVoid>(nullAllTypes.class);
		assertEquals(9, tableInfo.getFieldTypes().length);
		FieldType booleanField = tableInfo.getFieldTypes()[1];
		assertEquals("booleanField"booleanField.getColumnName());
		List<StringadditionalArgs = new ArrayList<String>();
		List<StringstatementsBefore = new ArrayList<String>();
		.appendColumnArg(nullsbbooleanFieldadditionalArgsstatementsBeforenullnull);
		assertTrue(sb.toString().contains("SMALLINT"));
	}
	public void testByte() throws Exception {
		TableInfo<AllTypesVoidtableInfo = new TableInfo<AllTypesVoid>(nullAllTypes.class);
		assertEquals(9, tableInfo.getFieldTypes().length);
		FieldType byteField = tableInfo.getFieldTypes()[3];
		assertEquals("byteField"byteField.getColumnName());
		List<StringadditionalArgs = new ArrayList<String>();
		List<StringstatementsBefore = new ArrayList<String>();
		.appendColumnArg(nullsbbyteFieldadditionalArgsstatementsBeforenullnull);
		assertTrue(sb.toString().contains("SMALLINT"));
	}
	public void testGeneratedId() throws Exception {
		TableInfo<GeneratedIdVoidtableInfo =
		List<StringadditionalArgs = new ArrayList<String>();
		List<StringstatementsBefore = new ArrayList<String>();
		.appendColumnArg(nullsbtableInfo.getFieldTypes()[0], additionalArgsstatementsBeforenull,
				null);
		.addPrimaryKeySql(tableInfo.getFieldTypes(), additionalArgsstatementsBeforenullnull);
		assertTrue(sb + "should contain the stuff"sb.toString().contains(" GENERATED ALWAYS AS IDENTITY"));
		assertEquals(0, statementsBefore.size());
		assertEquals(1, additionalArgs.size());
		assertTrue(additionalArgs.get(0).contains("PRIMARY KEY"));
	}
	public void testObject() throws Exception {
		Db2DatabaseType dbType = new Db2DatabaseType();
		dbType.appendByteArrayType(sb, 0);
		assertEquals("VARCHAR [] FOR BIT DATA"sb.toString());
	}
	public void testOffsetSupport() throws Exception {
	}
New to GrepCode? Check out our FAQ X