-
Notifications
You must be signed in to change notification settings - Fork 583
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update SugarRecord to return sensible values on multiple operations
- Loading branch information
Showing
6 changed files
with
143 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example.models; | ||
|
||
|
||
public class NoSugarModel { | ||
public NoSugarModel() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
example/src/test/java/com/example/sugartest/NoSugarModelTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.example.sugartest; | ||
|
||
import com.example.models.NoSugarModel; | ||
import com.orm.SugarRecord; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.robolectric.annotation.Config; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
|
||
|
||
@RunWith(RobolectricGradleTestRunner.class) | ||
@Config(emulateSdk=18) | ||
public class NoSugarModelTests { | ||
@Test | ||
public void deleteTest() throws Exception { | ||
NoSugarModel model = new NoSugarModel(); | ||
assertFalse(SugarRecord.delete(model)); | ||
} | ||
|
||
@Test | ||
public void saveInTransactionTest() throws Exception { | ||
SugarRecord.saveInTx(new NoSugarModel(), new NoSugarModel()); | ||
assertEquals(-1L, SugarRecord.count(NoSugarModel.class)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.