// Path: src/src/com/orm/androrm/field/DateField.java
// public class DateField extends DataField<Date> {
// 
// 	/**
// 	 * Initializes this field. Note, that dates will be
// 	 * stored as strings into the database. Therefore
// 	 * the database type of this field is <b>varchar</b>
// 	 * and it's length is set to 19 characters, as this
// 	 * is the exact length of the date string.
// 	 */
// 	public DateField() {
// 		mType = "varchar";
// 		mMaxLength = 19;
// 	}
// 	
// 	/**
// 	 * Constructs a {@link Date} object from the given string. <br />
// 	 * The String must be in the format: YYYY-MM-DDTHH:MM:SS.
// 	 * 
// 	 * @param date	String representing the date.
// 	 */
// 	public void fromString(String date) {
// 		Pattern pattern = Pattern.compile("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})");
// 		
// 		if(date != null) {
// 			Matcher matcher = pattern.matcher(date);
// 			
// 			if(matcher.matches()) {
// 				int year = Integer.valueOf(matcher.group(1));
// 				int month = Integer.valueOf(matcher.group(2)) - 1;
// 				int day = Integer.valueOf(matcher.group(3));
// 				int hour = Integer.valueOf(matcher.group(4));
// 				int minute = Integer.valueOf(matcher.group(5));
// 				int second = Integer.valueOf(matcher.group(6));
// 				
// 				GregorianCalendar cal = new GregorianCalendar(year, month, day, hour, minute, second);
// 				
// 				mValue = cal.getTime();
// 			}
// 		}
// 	}
// 	
// 	/**
// 	 * Creates the string representation of the date
// 	 * {@link DataField#mValue} is currently set to. 
// 	 * <br /><br />
// 	 * Format of that string is:<br />
// 	 * YYYY-MM-DDTHH:MM:SS
// 	 * 
// 	 * @return	String representation of {@link DataField#mValue}.
// 	 */
// 	public String getDateString() {
// 		if(mValue != null) {
// 			Calendar cal = Calendar.getInstance();
// 			cal.setTime(mValue);
// 			
// 			int year = cal.get(Calendar.YEAR);
// 			int month = cal.get(Calendar.MONTH) + 1;
// 			int day = cal.get(Calendar.DAY_OF_MONTH);
// 			int hour = cal.get(Calendar.HOUR_OF_DAY);
// 			int minute = cal.get(Calendar.MINUTE);
// 			int second = cal.get(Calendar.SECOND);
// 			
// 			String dayString = String.valueOf(day);
// 			String monthString = String.valueOf(month);
// 			String hourString = String.valueOf(hour);
// 			String minuteString = String.valueOf(minute);
// 			String secondString = String.valueOf(second);
// 			
// 			if(day < 10) {
// 				dayString = "0" + dayString;
// 			}
// 			
// 			if(month < 10) {
// 				monthString = "0" + monthString;
// 			}
// 			
// 			if(hour < 10) {
// 				hourString = "0" + hourString;
// 			}
// 			
// 			if(minute < 10) {
// 				minuteString = "0" + minuteString;
// 			}
// 			
// 			if(second < 10) {
// 				secondString = "0" + secondString;
// 			}
// 			
// 			return year + "-" + monthString + "-" + dayString
// 			 	+ "T"
// 			 	+ hourString + ":" + minuteString + ":" + secondString;
// 		}
// 		
// 		return null;
// 	}
// 
// 	@Override
// 	public void putData(String key, ContentValues values) {
// 		values.put(key, getDateString());
// 	}
// 
// 	@Override
// 	public void set(Cursor c, String fieldName) {
// 		fromString(c.getString(c.getColumnIndexOrThrow(fieldName)));
// 	}
// 
// 	@Override
// 	public void reset() {
// 		mValue = null;
// 	}
// }
// 
// Path: test/src/com/orm/androrm/impl/BlankModel.java
// public class BlankModel extends Model {
// 
// 	public static final QuerySet<BlankModel> objects(Context context) {
// 		return objects(context, BlankModel.class);
// 	}
// 	
// 	protected CharField mName;
// 	protected LocationField mLocation;
// 	protected DateField mDate;
// 	
// 	public BlankModel() {
// 		super();
// 		
// 		mName = new CharField();
// 		mLocation = new LocationField();
// 		mDate = new DateField();
// 	}
// 	
// 	public void setName(String name) {
// 		mName.set(name);
// 	}
// 	
// 	public String getName() {
// 		return mName.get();
// 	}
// 	
// 	public void setLocation(Location l) {
// 		mLocation.set(l);
// 	}
// 	
// 	public Location getLocation() {
// 		return mLocation.get();
// 	}
// 	
// 	public Date getDate() {
// 		return mDate.get();
// 	}
// 	
// 	public void setDate(Date date) {
// 		mDate.set(date);
// 	}
// }


import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import android.test.AndroidTestCase;
import com.orm.androrm.DatabaseAdapter;
import com.orm.androrm.Model;
import com.orm.androrm.field.DateField;
import com.orm.androrm.impl.BlankModel;
package com.orm.androrm.test.field;




public class DateFieldTest extends AndroidTestCase {

	@Override
	public void setUp() {
		List<Class<? extends Model>> models = new ArrayList<Class<? extends Model>>();
		models.add(BlankModel.class);

		DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext());
		adapter.setModels(models);
	}

	@Override
	public void tearDown() {
		DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext());
		adapter.drop();
	}

	public void testDefaults() {
// Path: src/src/com/orm/androrm/field/DateField.java
// public class DateField extends DataField<Date> {
// 
// 	/**
// 	 * Initializes this field. Note, that dates will be
// 	 * stored as strings into the database. Therefore
// 	 * the database type of this field is <b>varchar</b>
// 	 * and it's length is set to 19 characters, as this
// 	 * is the exact length of the date string.
// 	 */
// 	public DateField() {
// 		mType = "varchar";
// 		mMaxLength = 19;
// 	}
// 	
// 	/**
// 	 * Constructs a {@link Date} object from the given string. <br />
// 	 * The String must be in the format: YYYY-MM-DDTHH:MM:SS.
// 	 * 
// 	 * @param date	String representing the date.
// 	 */
// 	public void fromString(String date) {
// 		Pattern pattern = Pattern.compile("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})");
// 		
// 		if(date != null) {
// 			Matcher matcher = pattern.matcher(date);
// 			
// 			if(matcher.matches()) {
// 				int year = Integer.valueOf(matcher.group(1));
// 				int month = Integer.valueOf(matcher.group(2)) - 1;
// 				int day = Integer.valueOf(matcher.group(3));
// 				int hour = Integer.valueOf(matcher.group(4));
// 				int minute = Integer.valueOf(matcher.group(5));
// 				int second = Integer.valueOf(matcher.group(6));
// 				
// 				GregorianCalendar cal = new GregorianCalendar(year, month, day, hour, minute, second);
// 				
// 				mValue = cal.getTime();
// 			}
// 		}
// 	}
// 	
// 	/**
// 	 * Creates the string representation of the date
// 	 * {@link DataField#mValue} is currently set to. 
// 	 * <br /><br />
// 	 * Format of that string is:<br />
// 	 * YYYY-MM-DDTHH:MM:SS
// 	 * 
// 	 * @return	String representation of {@link DataField#mValue}.
// 	 */
// 	public String getDateString() {
// 		if(mValue != null) {
// 			Calendar cal = Calendar.getInstance();
// 			cal.setTime(mValue);
// 			
// 			int year = cal.get(Calendar.YEAR);
// 			int month = cal.get(Calendar.MONTH) + 1;
// 			int day = cal.get(Calendar.DAY_OF_MONTH);
// 			int hour = cal.get(Calendar.HOUR_OF_DAY);
// 			int minute = cal.get(Calendar.MINUTE);
// 			int second = cal.get(Calendar.SECOND);
// 			
// 			String dayString = String.valueOf(day);
// 			String monthString = String.valueOf(month);
// 			String hourString = String.valueOf(hour);
// 			String minuteString = String.valueOf(minute);
// 			String secondString = String.valueOf(second);
// 			
// 			if(day < 10) {
// 				dayString = "0" + dayString;
// 			}
// 			
// 			if(month < 10) {
// 				monthString = "0" + monthString;
// 			}
// 			
// 			if(hour < 10) {
// 				hourString = "0" + hourString;
// 			}
// 			
// 			if(minute < 10) {
// 				minuteString = "0" + minuteString;
// 			}
// 			
// 			if(second < 10) {
// 				secondString = "0" + secondString;
// 			}
// 			
// 			return year + "-" + monthString + "-" + dayString
// 			 	+ "T"
// 			 	+ hourString + ":" + minuteString + ":" + secondString;
// 		}
// 		
// 		return null;
// 	}
// 
// 	@Override
// 	public void putData(String key, ContentValues values) {
// 		values.put(key, getDateString());
// 	}
// 
// 	@Override
// 	public void set(Cursor c, String fieldName) {
// 		fromString(c.getString(c.getColumnIndexOrThrow(fieldName)));
// 	}
// 
// 	@Override
// 	public void reset() {
// 		mValue = null;
// 	}
// }
// 
// Path: test/src/com/orm/androrm/impl/BlankModel.java
// public class BlankModel extends Model {
// 
// 	public static final QuerySet<BlankModel> objects(Context context) {
// 		return objects(context, BlankModel.class);
// 	}
// 	
// 	protected CharField mName;
// 	protected LocationField mLocation;
// 	protected DateField mDate;
// 	
// 	public BlankModel() {
// 		super();
// 		
// 		mName = new CharField();
// 		mLocation = new LocationField();
// 		mDate = new DateField();
// 	}
// 	
// 	public void setName(String name) {
// 		mName.set(name);
// 	}
// 	
// 	public String getName() {
// 		return mName.get();
// 	}
// 	
// 	public void setLocation(Location l) {
// 		mLocation.set(l);
// 	}
// 	
// 	public Location getLocation() {
// 		return mLocation.get();
// 	}
// 	
// 	public Date getDate() {
// 		return mDate.get();
// 	}
// 	
// 	public void setDate(Date date) {
// 		mDate.set(date);
// 	}
// }


// Path: test/src/com/orm/androrm/test/field/DateFieldTest.java
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import android.test.AndroidTestCase;
import com.orm.androrm.DatabaseAdapter;
import com.orm.androrm.Model;
import com.orm.androrm.field.DateField;
import com.orm.androrm.impl.BlankModel;

package com.orm.androrm.test.field;




public class DateFieldTest extends AndroidTestCase {

	@Override
	public void setUp() {
		List<Class<? extends Model>> models = new ArrayList<Class<? extends Model>>();
		models.add(BlankModel.class);

		DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext());
		adapter.setModels(models);
	}

	@Override
	public void tearDown() {
		DatabaseAdapter adapter = DatabaseAdapter.getInstance(getContext());
		adapter.drop();
	}

	public void testDefaults() {
		DateField d = new DateField();