Rename tests for compatibility with AWS Device Farm

pull/77/merge
Alinson S. Xavier 10 years ago
parent 50a8aece6f
commit 3811f4b339

@ -37,7 +37,7 @@ import static org.hamcrest.Matchers.containsString;
public class HabitsApplicationTest
{
@Test
public void getLogcat() throws IOException
public void test_getLogcat() throws IOException
{
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
return;

@ -53,7 +53,7 @@ public class ArchiveHabitsCommandTest extends BaseTest
}
@Test
public void executeUndoRedo()
public void testExecuteUndoRedo()
{
assertFalse(habit.isArchived());

@ -62,7 +62,7 @@ public class ChangeHabitColorCommandTest extends BaseTest
}
@Test
public void executeUndoRedo()
public void testExecuteUndoRedo()
{
checkOriginalColors();

@ -30,13 +30,10 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.Collections;
import java.util.List;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
@RunWith(AndroidJUnit4.class)
@ -60,7 +57,7 @@ public class CreateHabitCommandTest extends BaseTest
}
@Test
public void executeUndoRedo()
public void testExecuteUndoRedo()
{
assertTrue(Habit.getAll(true).isEmpty());

@ -23,9 +23,7 @@ import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
import org.isoron.uhabits.BaseTest;
import org.isoron.uhabits.commands.ChangeHabitColorCommand;
import org.isoron.uhabits.commands.DeleteHabitsCommand;
import org.isoron.uhabits.helpers.ColorHelper;
import org.isoron.uhabits.models.Habit;
import org.isoron.uhabits.unit.HabitFixtures;
import org.junit.Before;
@ -36,7 +34,6 @@ import org.junit.runner.RunWith;
import java.util.LinkedList;
import static junit.framework.Assert.assertTrue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
@ -74,7 +71,7 @@ public class DeleteHabitsCommandTest extends BaseTest
}
@Test
public void executeUndoRedo()
public void testExecuteUndoRedo()
{
assertThat(Habit.getAll(true).size(), equalTo(4));

@ -63,7 +63,7 @@ public class EditHabitCommandTest extends BaseTest
}
@Test
public void executeUndoRedo()
public void testExecuteUndoRedo()
{
command = new EditHabitCommand(habit, modified);
@ -87,7 +87,7 @@ public class EditHabitCommandTest extends BaseTest
}
@Test
public void executeUndoRedo_withModifiedInterval()
public void testExecuteUndoRedo_withModifiedInterval()
{
modified.freqNum = 1;
modified.freqDen = 7;

@ -55,7 +55,7 @@ public class ToggleRepetitionCommandTest extends BaseTest
}
@Test
public void executeUndoRedo()
public void testExecuteUndoRedo()
{
assertTrue(habit.repetitions.contains(today));

@ -23,7 +23,6 @@ import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
import org.isoron.uhabits.BaseTest;
import org.isoron.uhabits.commands.ArchiveHabitsCommand;
import org.isoron.uhabits.commands.UnarchiveHabitsCommand;
import org.isoron.uhabits.models.Habit;
import org.isoron.uhabits.unit.HabitFixtures;
@ -56,7 +55,7 @@ public class UnarchiveHabitsCommandTest extends BaseTest
}
@Test
public void executeUndoRedo()
public void testExecuteUndoRedo()
{
assertTrue(habit.isArchived());

@ -86,7 +86,7 @@ public class HabitsCSVExporterTest extends BaseTest
}
@Test
public void exportCSV() throws IOException
public void testExportCSV() throws IOException
{
List<Habit> habits = Habit.getAll(true);

@ -93,7 +93,7 @@ public class ImportTest extends BaseTest
}
@Test
public void tickmateDB() throws IOException
public void testTickmateDB() throws IOException
{
importFromFile("tickmate.db");
@ -109,7 +109,7 @@ public class ImportTest extends BaseTest
}
@Test
public void rewireDB() throws IOException
public void testRewireDB() throws IOException
{
importFromFile("rewire.db");
@ -137,7 +137,7 @@ public class ImportTest extends BaseTest
}
@Test
public void habitbullCSV() throws IOException
public void testHabitBullCSV() throws IOException
{
importFromFile("habitbull.csv");
@ -155,7 +155,7 @@ public class ImportTest extends BaseTest
}
@Test
public void loopDB() throws IOException
public void testLoopDB() throws IOException
{
importFromFile("loop.db");

@ -64,7 +64,7 @@ public class CheckmarkListTest extends BaseTest
}
@Test
public void getAllValues_withNonDailyHabit()
public void test_getAllValues_withNonDailyHabit()
{
int[] expectedValues = { CHECKED_EXPLICITLY, UNCHECKED, CHECKED_IMPLICITLY,
CHECKED_EXPLICITLY, CHECKED_EXPLICITLY, CHECKED_EXPLICITLY, UNCHECKED,
@ -76,7 +76,7 @@ public class CheckmarkListTest extends BaseTest
}
@Test
public void getAllValues_withEmptyHabit()
public void test_getAllValues_withEmptyHabit()
{
int[] expectedValues = new int[0];
int[] actualValues = emptyHabit.checkmarks.getAllValues();
@ -85,7 +85,7 @@ public class CheckmarkListTest extends BaseTest
}
@Test
public void getAllValues_moveForwardInTime()
public void test_getAllValues_moveForwardInTime()
{
travelInTime(3);
@ -99,7 +99,7 @@ public class CheckmarkListTest extends BaseTest
}
@Test
public void getAllValues_moveBackwardsInTime()
public void test_getAllValues_moveBackwardsInTime()
{
travelInTime(-3);
@ -112,14 +112,14 @@ public class CheckmarkListTest extends BaseTest
}
@Test
public void getValues_withInvalidInterval()
public void test_getValues_withInvalidInterval()
{
int values[] = nonDailyHabit.checkmarks.getValues(100L, -100L);
assertThat(values, equalTo(new int[0]));
}
@Test
public void getValues_withValidInterval()
public void test_getValues_withValidInterval()
{
long from = DateHelper.getStartOfToday() - 15 * DateHelper.millisecondsInOneDay;
long to = DateHelper.getStartOfToday() - 5 * DateHelper.millisecondsInOneDay;
@ -134,7 +134,7 @@ public class CheckmarkListTest extends BaseTest
}
@Test
public void getTodayValue()
public void test_getTodayValue()
{
travelInTime(-1);
assertThat(nonDailyHabit.checkmarks.getTodayValue(), equalTo(UNCHECKED));
@ -147,7 +147,7 @@ public class CheckmarkListTest extends BaseTest
}
@Test
public void writeCSV() throws IOException
public void test_writeCSV() throws IOException
{
String expectedCSV =
"2015-01-16,2\n" +

@ -56,7 +56,7 @@ public class HabitTest extends BaseTest
}
@Test
public void constructor_default()
public void testConstructor_default()
{
Habit habit = new Habit();
assertThat(habit.archived, is(0));
@ -73,7 +73,7 @@ public class HabitTest extends BaseTest
}
@Test
public void constructor_habit()
public void testConstructor_habit()
{
Habit model = new Habit();
model.archived = 1;
@ -99,7 +99,7 @@ public class HabitTest extends BaseTest
}
@Test
public void get_withValidId()
public void test_get_withValidId()
{
Habit habit = new Habit();
habit.save();
@ -109,14 +109,14 @@ public class HabitTest extends BaseTest
}
@Test
public void get_withInvalidId()
public void test_get_withInvalidId()
{
Habit habit = Habit.get(123456L);
assertThat(habit, is(nullValue()));
}
@Test
public void getAll_withoutArchived()
public void test_getAll_withoutArchived()
{
List<Habit> habits = new LinkedList<>();
List<Habit> habitsWithArchived = new LinkedList<>();
@ -139,7 +139,7 @@ public class HabitTest extends BaseTest
}
@Test
public void getByPosition()
public void test_getByPosition()
{
List<Habit> habits = new LinkedList<>();
@ -159,7 +159,7 @@ public class HabitTest extends BaseTest
}
@Test
public void count()
public void test_count()
{
for(int i = 0; i < 10; i++)
{
@ -173,7 +173,7 @@ public class HabitTest extends BaseTest
@Test
public void countWithArchived()
public void test_countWithArchived()
{
for(int i = 0; i < 10; i++)
{
@ -186,7 +186,7 @@ public class HabitTest extends BaseTest
}
@Test
public void updateId()
public void test_updateId()
{
Habit habit = new Habit();
habit.name = "Hello World";
@ -203,7 +203,7 @@ public class HabitTest extends BaseTest
}
@Test
public void reorder()
public void test_reorder()
{
List<Long> ids = new LinkedList<>();
@ -253,7 +253,7 @@ public class HabitTest extends BaseTest
}
@Test
public void rebuildOrder()
public void test_rebuildOrder()
{
List<Long> ids = new LinkedList<>();
int originalPositions[] = { 0, 1, 1, 4, 6, 8, 10, 10, 13};
@ -277,7 +277,7 @@ public class HabitTest extends BaseTest
}
@Test
public void getHabitsWithReminder()
public void test_getHabitsWithReminder()
{
List<Habit> habitsWithReminder = new LinkedList<>();
@ -298,7 +298,7 @@ public class HabitTest extends BaseTest
}
@Test
public void archive_unarchive()
public void test_archive_unarchive()
{
List<Habit> allHabits = new LinkedList<>();
List<Habit> archivedHabits = new LinkedList<>();
@ -326,7 +326,7 @@ public class HabitTest extends BaseTest
}
@Test
public void setColor()
public void test_setColor()
{
List<Habit> habits = new LinkedList<>();
@ -346,7 +346,7 @@ public class HabitTest extends BaseTest
}
@Test
public void hasReminder_clearReminder()
public void test_hasReminder_clearReminder()
{
Habit h = new Habit();
assertThat(h.hasReminder(), is(false));
@ -361,7 +361,7 @@ public class HabitTest extends BaseTest
}
@Test
public void writeCSV() throws IOException
public void test_writeCSV() throws IOException
{
HabitFixtures.createEmptyHabit();
HabitFixtures.createShortHabit();

@ -66,7 +66,7 @@ public class RepetitionListTest extends BaseTest
}
@Test
public void contains()
public void test_contains()
{
long current = DateHelper.getStartOfToday();
@ -84,7 +84,7 @@ public class RepetitionListTest extends BaseTest
}
@Test
public void delete()
public void test_delete()
{
long timestamp = DateHelper.getStartOfToday();
assertThat(habit.repetitions.contains(timestamp), equalTo(true));
@ -94,7 +94,7 @@ public class RepetitionListTest extends BaseTest
}
@Test
public void toggle()
public void test_toggle()
{
long timestamp = DateHelper.getStartOfToday();
assertThat(habit.repetitions.contains(timestamp), equalTo(true));
@ -107,7 +107,7 @@ public class RepetitionListTest extends BaseTest
}
@Test
public void getWeekDayFrequency()
public void test_getWeekDayFrequency()
{
Random random = new Random();
Integer weekdayCount[][] = new Integer[12][7];
@ -166,7 +166,7 @@ public class RepetitionListTest extends BaseTest
}
@Test
public void count()
public void test_count()
{
long to = DateHelper.getStartOfToday();
long from = to - 9 * DateHelper.millisecondsInOneDay;
@ -178,7 +178,7 @@ public class RepetitionListTest extends BaseTest
}
@Test
public void getOldest()
public void test_getOldest()
{
long expectedOldestTimestamp = DateHelper.getStartOfToday() - 9 * DateHelper.millisecondsInOneDay;

@ -61,7 +61,7 @@ public class ScoreListTest extends BaseTest
}
@Test
public void invalidateNewerThan()
public void test_invalidateNewerThan()
{
assertThat(habit.scores.getTodayValue(), equalTo(0));
@ -76,7 +76,7 @@ public class ScoreListTest extends BaseTest
}
@Test
public void getTodayStarValue()
public void test_getTodayStarValue()
{
assertThat(habit.scores.getTodayStarStatus(), equalTo(Score.EMPTY_STAR));
@ -89,14 +89,14 @@ public class ScoreListTest extends BaseTest
}
@Test
public void getTodayValue()
public void test_getTodayValue()
{
toggleRepetitions(0, 20);
assertThat(habit.scores.getTodayValue(), equalTo(12629351));
}
@Test
public void getValue()
public void test_getValue()
{
toggleRepetitions(0, 20);
@ -113,7 +113,7 @@ public class ScoreListTest extends BaseTest
}
@Test
public void getAllValues_withoutGroups()
public void test_getAllValues_withoutGroups()
{
toggleRepetitions(0, 20);
@ -126,7 +126,7 @@ public class ScoreListTest extends BaseTest
}
@Test
public void getAllValues_withGroups()
public void test_getAllValues_withGroups()
{
toggleRepetitions(0, 20);
@ -137,7 +137,7 @@ public class ScoreListTest extends BaseTest
}
@Test
public void writeCSV() throws IOException
public void test_writeCSV() throws IOException
{
HabitFixtures.purgeHabits();
Habit habit = HabitFixtures.createShortHabit();

@ -43,7 +43,7 @@ public class ScoreTest extends BaseTest
}
@Test
public void compute_withDailyHabit()
public void test_compute_withDailyHabit()
{
int checkmark = Checkmark.UNCHECKED;
assertThat(Score.compute(1, 0, checkmark), equalTo(0));
@ -65,7 +65,7 @@ public class ScoreTest extends BaseTest
}
@Test
public void compute_withNonDailyHabit()
public void test_compute_withNonDailyHabit()
{
int checkmark = Checkmark.CHECKED_EXPLICITLY;
assertThat(Score.compute(1/3.0, 0, checkmark), equalTo(1000000));
@ -80,7 +80,7 @@ public class ScoreTest extends BaseTest
}
@Test
public void getStarStatus()
public void test_getStarStatus()
{
Score s = new Score();

@ -51,7 +51,7 @@ public class ExportCSVTaskTest extends BaseTest
}
@Test
public void exportCSV() throws Throwable
public void testExportCSV() throws Throwable
{
HabitFixtures.createShortHabit();
List<Habit> habits = Habit.getAll(true);

@ -50,7 +50,7 @@ public class ExportDBTaskTest extends BaseTest
}
@Test
public void exportCSV() throws Throwable
public void testExportCSV() throws Throwable
{
Context context = InstrumentationRegistry.getContext();

@ -88,13 +88,13 @@ public class ImportDataTaskTest extends BaseTest
}
@Test
public void importInvalidData() throws Throwable
public void testImportInvalidData() throws Throwable
{
assertTaskResult(ImportDataTask.NOT_RECOGNIZED, "icon.png");
}
@Test
public void importValidData() throws Throwable
public void testImportValidData() throws Throwable
{
assertTaskResult(ImportDataTask.SUCCESS, "loop.db");
}

@ -52,13 +52,13 @@ public class CheckmarkViewTest extends ViewTest
}
@Test
public void render_checked() throws IOException
public void testRender_checked() throws IOException
{
assertRenders(view, "CheckmarkView/checked.png");
}
@Test
public void render_unchecked() throws IOException
public void testRender_unchecked() throws IOException
{
habit.repetitions.toggle(DateHelper.getStartOfToday());
view.refreshData();
@ -67,7 +67,7 @@ public class CheckmarkViewTest extends ViewTest
}
@Test
public void render_implicitlyChecked() throws IOException
public void testRender_implicitlyChecked() throws IOException
{
long today = DateHelper.getStartOfToday();
long day = DateHelper.millisecondsInOneDay;
@ -80,7 +80,7 @@ public class CheckmarkViewTest extends ViewTest
}
@Test
public void render_largeSize() throws IOException
public void testRender_largeSize() throws IOException
{
measureView(dpToPixels(300), dpToPixels(300), view);
assertRenders(view, "CheckmarkView/large_size.png");

@ -50,27 +50,27 @@ public class HabitFrequencyViewTest extends ViewTest
}
@Test
public void render() throws Throwable
public void testRender() throws Throwable
{
assertRenders(view, "HabitFrequencyView/render.png");
}
@Test
public void render_withTransparentBackground() throws Throwable
public void testRender_withTransparentBackground() throws Throwable
{
view.setIsBackgroundTransparent(true);
assertRenders(view, "HabitFrequencyView/renderTransparent.png");
}
@Test
public void render_withDifferentSize() throws Throwable
public void testRender_withDifferentSize() throws Throwable
{
measureView(dpToPixels(200), dpToPixels(200), view);
assertRenders(view, "HabitFrequencyView/renderDifferentSize.png");
}
@Test
public void render_withDataOffset() throws Throwable
public void testRender_withDataOffset() throws Throwable
{
view.onScroll(null, null, -dpToPixels(150), 0);
view.invalidate();

@ -57,27 +57,27 @@ public class HabitHistoryViewTest extends ViewTest
}
@Test
public void render() throws Throwable
public void testRender() throws Throwable
{
assertRenders(view, "HabitHistoryView/render.png");
}
@Test
public void render_withTransparentBackground() throws Throwable
public void testRender_withTransparentBackground() throws Throwable
{
view.setIsBackgroundTransparent(true);
assertRenders(view, "HabitHistoryView/renderTransparent.png");
}
@Test
public void render_withDifferentSize() throws Throwable
public void testRender_withDifferentSize() throws Throwable
{
measureView(dpToPixels(200), dpToPixels(200), view);
assertRenders(view, "HabitHistoryView/renderDifferentSize.png");
}
@Test
public void render_withDataOffset() throws Throwable
public void testRender_withDataOffset() throws Throwable
{
view.onScroll(null, null, -dpToPixels(150), 0);
view.invalidate();

@ -53,28 +53,28 @@ public class HabitScoreViewTest extends ViewTest
}
@Test
public void render() throws Throwable
public void testRender() throws Throwable
{
Log.d("HabitScoreViewTest", String.format("height=%d", dpToPixels(100)));
assertRenders(view, "HabitScoreView/render.png");
}
@Test
public void render_withTransparentBackground() throws Throwable
public void testRender_withTransparentBackground() throws Throwable
{
view.setIsBackgroundTransparent(true);
assertRenders(view, "HabitScoreView/renderTransparent.png");
}
@Test
public void render_withDifferentSize() throws Throwable
public void testRender_withDifferentSize() throws Throwable
{
measureView(dpToPixels(200), dpToPixels(200), view);
assertRenders(view, "HabitScoreView/renderDifferentSize.png");
}
@Test
public void render_withDataOffset() throws Throwable
public void testRender_withDataOffset() throws Throwable
{
view.onScroll(null, null, -dpToPixels(150), 0);
view.invalidate();
@ -83,7 +83,7 @@ public class HabitScoreViewTest extends ViewTest
}
@Test
public void render_withMonthlyBucket() throws Throwable
public void testRender_withMonthlyBucket() throws Throwable
{
view.setBucketSize(30);
view.refreshData();
@ -93,7 +93,7 @@ public class HabitScoreViewTest extends ViewTest
}
@Test
public void render_withYearlyBucket() throws Throwable
public void testRender_withYearlyBucket() throws Throwable
{
view.setBucketSize(365);
view.refreshData();

@ -51,20 +51,20 @@ public class HabitStreakViewTest extends ViewTest
}
@Test
public void render() throws Throwable
public void testRender() throws Throwable
{
assertRenders(view, "HabitStreakView/render.png");
}
@Test
public void render_withTransparentBackground() throws Throwable
public void testRender_withTransparentBackground() throws Throwable
{
view.setIsBackgroundTransparent(true);
assertRenders(view, "HabitStreakView/renderTransparent.png");
}
@Test
public void render_withSmallSize() throws Throwable
public void testRender_withSmallSize() throws Throwable
{
measureView(dpToPixels(100), dpToPixels(100), view);
refreshData(view);

@ -50,13 +50,13 @@ public class NumberViewTest extends ViewTest
}
@Test
public void render_base() throws IOException
public void testRender_base() throws IOException
{
assertRenders(view, "NumberView/render.png");
}
@Test
public void render_withLongLabel() throws IOException
public void testRender_withLongLabel() throws IOException
{
view.setLabel("The quick brown fox jumps over the lazy fox");
@ -65,7 +65,7 @@ public class NumberViewTest extends ViewTest
}
@Test
public void render_withDifferentParams() throws IOException
public void testRender_withDifferentParams() throws IOException
{
view.setNumber(500);
view.setColor(ColorHelper.palette[5]);

@ -49,14 +49,14 @@ public class RingViewTest extends ViewTest
}
@Test
public void render_base() throws IOException
public void testRender_base() throws IOException
{
measureView(dpToPixels(100), dpToPixels(100), view);
assertRenders(view, "RingView/render.png");
}
@Test
public void render_withLongLabel() throws IOException
public void testRender_withLongLabel() throws IOException
{
view.setLabel("The quick brown fox jumps over the lazy fox");
@ -65,7 +65,7 @@ public class RingViewTest extends ViewTest
}
@Test
public void render_withDifferentParams() throws IOException
public void testRender_withDifferentParams() throws IOException
{
view.setLabel("Habit Strength");
view.setPercentage(0.25f);

Loading…
Cancel
Save