Skip to content

Commit

Permalink
Merge pull request #205 from joshuapinter/fix_tests
Browse files Browse the repository at this point in the history
Fix test suite.
  • Loading branch information
SeanPONeil committed Apr 5, 2014
2 parents ae6588a + 87bb981 commit 3df94a5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
5 changes: 3 additions & 2 deletions tests/src/com/activeandroid/test/CacheTest.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
package com.activeandroid.test;

import android.test.AndroidTestCase;

import com.activeandroid.ActiveAndroid;
import com.activeandroid.Cache;
import com.activeandroid.Configuration;
import com.activeandroid.Model;
import com.activeandroid.TableInfo;
import com.activeandroid.annotation.Table;

import android.test.AndroidTestCase;

import java.util.Collection;

public class CacheTest extends AndroidTestCase {

@Override
protected void setUp() {
Configuration conf = new Configuration.Builder(getContext())
.setDatabaseName("CacheTest")
.addModelClasses(CacheTestModel.class, CacheTestModel2.class)
.create();
ActiveAndroid.initialize(conf, true);
Expand Down
2 changes: 1 addition & 1 deletion tests/src/com/activeandroid/test/MockModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
import com.activeandroid.Model;
import com.activeandroid.annotation.Table;

@Table(name = "MockModel", id = "Id")
@Table(name = "MockModel")
public class MockModel extends Model {
}
10 changes: 7 additions & 3 deletions tests/src/com/activeandroid/test/ModelTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

import com.activeandroid.Model;
import com.activeandroid.annotation.Table;

import java.util.HashSet;
import java.util.Set;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;

/**
* Simple test now covering equals and hashcode methods.
Expand Down Expand Up @@ -58,7 +57,7 @@ public void testEqualsOnNew() {

assertFalse(model1.equals(model2));
assertFalse(model2.equals(model1));
assertTrue(model1.equals(model1));//equal only to itself
assertTrue(model1.equals(model1)); //equal only to itself
}

/**
Expand All @@ -73,10 +72,15 @@ public void testEqualsDifferentRows() {
model2.save();
model3 = Model.load(MockModel.class, model1.getId());

// Not equal to each other.
assertFalse(model1.equals(model2));
assertFalse(model2.equals(model1));

// Equal to each other when loaded.
assertTrue(model1.equals(model3));
assertTrue(model1.equals(model3));

// Loaded model is not equal to a different model.
assertFalse(model3.equals(model2));
assertFalse(model2.equals(model3));
}
Expand Down
4 changes: 2 additions & 2 deletions tests/src/com/activeandroid/test/query/FromTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ private From from() {
return new Select().all().from(MockModel.class);
}

@Table(name = "JoinModel", id = "Id")
@Table(name = "JoinModel")
private static class JoinModel extends Model {
}

@Table(name = "JoinModel2", id = "Id")
@Table(name = "JoinModel2")
private static class JoinModel2 extends Model {
}
}

0 comments on commit 3df94a5

Please sign in to comment.