Fix broken tests
This commit is contained in:
parent
80ec8e9b17
commit
fdef9990d4
2 changed files with 5 additions and 22 deletions
|
@ -1,17 +0,0 @@
|
||||||
package com.wbrawner.simplemarkdown;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Example local unit test, which will execute on the development machine (host).
|
|
||||||
*
|
|
||||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
|
||||||
*/
|
|
||||||
public class ExampleUnitTest {
|
|
||||||
@Test
|
|
||||||
public void addition_isCorrect() throws Exception {
|
|
||||||
assertEquals(4, 2 + 2);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,8 +4,8 @@ import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.wbrawner.simplemarkdown.utility.Constants;
|
||||||
import com.wbrawner.simplemarkdown.utility.Utils;
|
import com.wbrawner.simplemarkdown.utility.Utils;
|
||||||
import com.wbrawner.simplemarkdown.view.activity.SettingsActivity;
|
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -44,13 +44,13 @@ public class UtilsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getDocsPath() throws Exception {
|
public void getDocsPath() throws Exception {
|
||||||
sharedPreferences.edit().putString(SettingsActivity.KEY_DOCS_PATH, rootDir).apply();
|
sharedPreferences.edit().putString(Constants.KEY_DOCS_PATH, rootDir).apply();
|
||||||
assertEquals(rootDir, Utils.getDocsPath(context));
|
assertEquals(rootDir, Utils.getDocsPath(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getDefaultFileName() throws Exception {
|
public void getDefaultFileName() throws Exception {
|
||||||
sharedPreferences.edit().putString(SettingsActivity.KEY_DOCS_PATH, rootDir).apply();
|
sharedPreferences.edit().putString(Constants.KEY_DOCS_PATH, rootDir).apply();
|
||||||
|
|
||||||
new File(rootDir, "dummy.md").createNewFile();
|
new File(rootDir, "dummy.md").createNewFile();
|
||||||
new File(rootDir, "dummy1.md").createNewFile();
|
new File(rootDir, "dummy1.md").createNewFile();
|
||||||
|
@ -72,7 +72,7 @@ public class UtilsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getDefaultFileNameDoubleDigitTest() throws IOException {
|
public void getDefaultFileNameDoubleDigitTest() throws IOException {
|
||||||
sharedPreferences.edit().putString(SettingsActivity.KEY_DOCS_PATH, rootDir).apply();
|
sharedPreferences.edit().putString(Constants.KEY_DOCS_PATH, rootDir).apply();
|
||||||
|
|
||||||
for (int i = 0; i < 11; i++) {
|
for (int i = 0; i < 11; i++) {
|
||||||
new File(rootDir, "Untitled-" + i + ".md").createNewFile();
|
new File(rootDir, "Untitled-" + i + ".md").createNewFile();
|
||||||
|
@ -85,7 +85,7 @@ public class UtilsTest {
|
||||||
@Test
|
@Test
|
||||||
public void isAutosaveEnabled() throws Exception {
|
public void isAutosaveEnabled() throws Exception {
|
||||||
assertTrue(Utils.isAutosaveEnabled(context));
|
assertTrue(Utils.isAutosaveEnabled(context));
|
||||||
sharedPreferences.edit().putBoolean(SettingsActivity.KEY_AUTOSAVE, false).apply();
|
sharedPreferences.edit().putBoolean(Constants.KEY_AUTOSAVE, false).apply();
|
||||||
assertFalse(Utils.isAutosaveEnabled(context));
|
assertFalse(Utils.isAutosaveEnabled(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue