Skip to content

Commit dc86481

Browse files
Merge branch 'release/v1.2.1'
2 parents 2e9f774 + 2c88edd commit dc86481

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
/captures
77
.idea
88
app/app-release.apk
9+
app/release/

app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ android {
99
applicationId "luankevinferreira.expenses"
1010
minSdkVersion 16
1111
targetSdkVersion 27
12-
versionCode 16
13-
versionName "1.2.0"
12+
versionCode 17
13+
versionName "1.2.1"
1414
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1515
}
1616
buildTypes {

app/src/androidTest/java/luankevinferreira/expenses/dao/TypeDAOTest.java

+17-7
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,16 @@
66

77
import org.junit.After;
88
import org.junit.Before;
9-
import org.junit.Ignore;
109
import org.junit.Test;
1110
import org.junit.runner.RunWith;
1211

1312
import java.io.IOException;
1413
import java.util.List;
1514

16-
import luankevinferreira.expenses.domain.Type;
17-
1815
import static junit.framework.Assert.assertEquals;
1916
import static junit.framework.Assert.assertFalse;
2017
import static junit.framework.Assert.assertNotNull;
2118

22-
/**
23-
* Created by Luan Kevin Ferreira.
24-
*/
2519
@RunWith(AndroidJUnit4.class)
2620
@LargeTest
2721
public class TypeDAOTest {
@@ -46,7 +40,7 @@ public void testPreConditions() {
4640
@Test
4741
public void testFindAllDescriptions() throws Exception {
4842
// Prepare
49-
String expectedName = "Food";
43+
String expectedName = "Clothes";
5044

5145
// Action
5246
List<String> descriptions = typeDAO.findAllDescriptions();
@@ -56,4 +50,20 @@ public void testFindAllDescriptions() throws Exception {
5650
assertFalse(descriptions.isEmpty());
5751
assertEquals(expectedName, descriptions.get(0));
5852
}
53+
54+
@Test
55+
public void testOrderBy() {
56+
// Prepare
57+
List<String> descriptions;
58+
59+
// Action
60+
descriptions = typeDAO.findAllDescriptions();
61+
62+
// Verify
63+
assertNotNull(descriptions);
64+
assertFalse(descriptions.isEmpty());
65+
assertEquals("Clothes", descriptions.get(0));
66+
assertEquals("Dwelling", descriptions.get(1));
67+
assertEquals("Education", descriptions.get(2));
68+
}
5969
}

app/src/main/java/luankevinferreira/expenses/dao/TypeDAO.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private SQLiteDatabase getSqLiteDatabase() {
4141
* @return list of all description types of expenses stored in the database.
4242
*/
4343
public List<String> findAllDescriptions() {
44-
Cursor cursor = getSqLiteDatabase().rawQuery("SELECT * FROM type", null);
44+
Cursor cursor = getSqLiteDatabase().rawQuery("SELECT * FROM type ORDER BY description", null);
4545

4646
List<String> types = new ArrayList<>();
4747

0 commit comments

Comments
 (0)