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.assertTrue;
 
 import java.util.List;
 
	protected void setDatabaseParams() throws SQLException {
		 = "jdbc:mysql:ormlite";
	}
	protected boolean isDriverClassExpected() {
		return false;
	}
	public void testBoolean() throws Exception {
		if ( == null) {
			return;
		}
		TableInfo<AllTypesIntegertableInfo =
		assertEquals(9, tableInfo.getFieldTypes().length);
		FieldType booleanField = tableInfo.getFieldTypes()[1];
		assertEquals("booleanField"booleanField.getDbColumnName());
		List<StringadditionalArgs = new ArrayList<String>();
		List<StringstatementsBefore = new ArrayList<String>();
		.appendColumnArg(sbbooleanFieldadditionalArgsstatementsBeforenullnull);
		assertTrue(sb.toString().contains("TINYINT(1)"));
	}
	public void testGeneratedIdBuilt() throws Exception {
		if ( == null) {
			return;
		}
		TableInfo<GeneratedIdIntegertableInfo =
		assertEquals(2, tableInfo.getFieldTypes().length);
		List<StringadditionalArgs = new ArrayList<String>();
		List<StringstatementsBefore = new ArrayList<String>();
		.appendColumnArg(sbtableInfo.getFieldTypes()[0], additionalArgsstatementsBeforenullnull);
		.addPrimaryKeySql(tableInfo.getFieldTypes(), additionalArgsstatementsBeforenullnull);
		assertTrue(sb.toString().contains(" AUTO_INCREMENT"));
		assertEquals(1, additionalArgs.size());
		assertTrue(additionalArgs.get(0).contains("PRIMARY KEY"));
	}
	public void testTableSuffix() throws Exception {
		String suffix = "ewfwefef";
		dbType.setCreateTableSuffix(suffix);
	}
	public void testDateTime() throws Exception {
		dbType.appendDateType(sb, 0);
		assertEquals("DATETIME"sb.toString());
	}
	public void testObject() throws Exception {
		dbType.appendByteArrayType(sb, 0);
		assertEquals("BLOB"sb.toString());
	}
New to GrepCode? Check out our FAQ X