|
|
@ -17,33 +17,26 @@
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package org.isoron.uhabits.unit.commands;
|
|
|
|
package org.isoron.uhabits.commands;
|
|
|
|
|
|
|
|
|
|
|
|
import android.support.test.runner.AndroidJUnit4;
|
|
|
|
import org.isoron.uhabits.*;
|
|
|
|
import android.test.suitebuilder.annotation.SmallTest;
|
|
|
|
import org.isoron.uhabits.models.*;
|
|
|
|
|
|
|
|
import org.junit.*;
|
|
|
|
|
|
|
|
|
|
|
|
import org.isoron.uhabits.BaseAndroidTest;
|
|
|
|
import java.util.*;
|
|
|
|
import org.isoron.uhabits.commands.CreateHabitCommand;
|
|
|
|
|
|
|
|
import org.isoron.uhabits.models.Habit;
|
|
|
|
|
|
|
|
import org.junit.Before;
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import static junit.framework.Assert.*;
|
|
|
|
|
|
|
|
import static org.hamcrest.CoreMatchers.*;
|
|
|
|
|
|
|
|
import static org.hamcrest.MatcherAssert.*;
|
|
|
|
|
|
|
|
|
|
|
|
import static junit.framework.Assert.assertTrue;
|
|
|
|
public class CreateHabitCommandTest extends BaseUnitTest
|
|
|
|
import static org.hamcrest.MatcherAssert.assertThat;
|
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.equalTo;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RunWith(AndroidJUnit4.class)
|
|
|
|
|
|
|
|
@SmallTest
|
|
|
|
|
|
|
|
public class CreateHabitCommandTest extends BaseAndroidTest
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
private CreateHabitCommand command;
|
|
|
|
private CreateHabitCommand command;
|
|
|
|
|
|
|
|
|
|
|
|
private Habit model;
|
|
|
|
private Habit model;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Before
|
|
|
|
@Before
|
|
|
|
public void setUp()
|
|
|
|
public void setUp()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -52,8 +45,7 @@ public class CreateHabitCommandTest extends BaseAndroidTest
|
|
|
|
model = new Habit();
|
|
|
|
model = new Habit();
|
|
|
|
model.setName("New habit");
|
|
|
|
model.setName("New habit");
|
|
|
|
command = new CreateHabitCommand(model);
|
|
|
|
command = new CreateHabitCommand(model);
|
|
|
|
|
|
|
|
fixtures.purgeHabits();
|
|
|
|
fixtures.purgeHabits(habitList);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -82,4 +74,6 @@ public class CreateHabitCommandTest extends BaseAndroidTest
|
|
|
|
assertThat(id, equalTo(newId));
|
|
|
|
assertThat(id, equalTo(newId));
|
|
|
|
assertThat(habit.getName(), equalTo(model.getName()));
|
|
|
|
assertThat(habit.getName(), equalTo(model.getName()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|