-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Start reporting errors from RxJava * Others
- Loading branch information
1 parent
fc5aeed
commit 9e993cc
Showing
12 changed files
with
224 additions
and
21 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
Binary file not shown.
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
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,29 @@ | ||
package io.mgba; | ||
|
||
import android.app.Application; | ||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.Mock; | ||
import org.mockito.runners.MockitoJUnitRunner; | ||
import io.mgba.Model.Interfaces.ILibrary; | ||
import io.mgba.Model.Library; | ||
import io.mgba.Utils.TestsDB; | ||
import io.mgba.Utils.TestsFLM; | ||
|
||
@RunWith(AndroidJUnit4.class) | ||
public class LibraryTests { | ||
|
||
private ILibrary library; | ||
|
||
@Before | ||
public void init() { | ||
Context ctx = InstrumentationRegistry.getTargetContext(); | ||
library = new Library(((mgba)ctx.getApplicationContext()), new TestsDB(), new TestsFLM()); | ||
} | ||
|
||
} |
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,61 @@ | ||
package io.mgba.Utils; | ||
|
||
import org.junit.BeforeClass; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
import io.mgba.Data.Database.Game; | ||
import io.mgba.Data.Platform; | ||
import io.mgba.Model.Interfaces.IDatabase; | ||
|
||
public class TestsDB implements IDatabase{ | ||
private static List<Game> games; | ||
|
||
@BeforeClass | ||
public static void init() { | ||
games = new LinkedList<>(); | ||
games.add(new Game("/a.gba", "Pokemon", "Some desc", "2000", "I", "", "", "AAA", false, Platform.GBA)); | ||
games.add(new Game("/b.gba", "Metroid", "Some desc", "2000", "I", "", "", "AAA", true, Platform.GBA)); | ||
games.add(new Game("/c.gba", "Zelda", "Some desc", "2000", "I", "", "", "AAA", true, Platform.GBC)); | ||
games.add(new Game("/d.gba", "Mario", "Some desc", "2000", "I", "", "", "AAA", false, Platform.GBC)); | ||
|
||
} | ||
|
||
@Override | ||
public List<Game> getGamesForPlatform(Platform platform) { | ||
return games; | ||
} | ||
|
||
@Override | ||
public List<Game> getFavouritesGames() { | ||
return games; | ||
} | ||
|
||
@Override | ||
public void insert(Game... games) { | ||
|
||
} | ||
|
||
@Override | ||
public void delete() { | ||
|
||
} | ||
|
||
@Override | ||
public void delete(Game game) { | ||
System.out.println(""); | ||
|
||
|
||
} | ||
|
||
@Override | ||
public List<Game> queryForGames(String query) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<Game> getGames() { | ||
return null; | ||
} | ||
} |
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,45 @@ | ||
package io.mgba.Utils; | ||
|
||
import com.google.common.base.Predicate; | ||
|
||
import org.junit.BeforeClass; | ||
|
||
import java.io.File; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
import io.mgba.Model.Interfaces.IFilesManager; | ||
|
||
public class TestsFLM implements IFilesManager { | ||
private static List<File> files; | ||
|
||
private String dir = ""; | ||
|
||
@BeforeClass | ||
public static void init() { | ||
files = new LinkedList<>(); | ||
files.add(new File("/a.b")); | ||
files.add(new File("/c.d")); | ||
files.add(new File("/e.f")); | ||
files.add(new File("/g.h")); | ||
} | ||
|
||
@Override | ||
public List<File> getGameList(Predicate predicate) { | ||
return files; | ||
} | ||
|
||
@Override | ||
public List<File> getGameList() { | ||
return files; | ||
} | ||
|
||
@Override | ||
public String getCurrentDirectory() { | ||
return dir; | ||
} | ||
|
||
@Override | ||
public void setCurrentDirectory(String directory) { | ||
dir = directory; | ||
} | ||
} |
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
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
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,29 @@ | ||
package io.mgba; | ||
|
||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
import io.mgba.Model.IO.FilesManager; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class FileManagerTests { | ||
|
||
@Test | ||
public void getExtensionOnFileWithExtension(){ | ||
assertEquals("test", FilesManager.getFileExtension(new File("/something.test"))); | ||
} | ||
|
||
|
||
@Test | ||
public void getExtensionOnFileWithoutExtension(){ | ||
assertEquals("est", FilesManager.getFileExtension(new File("/somethingtest"))); | ||
} | ||
|
||
@Test | ||
public void getFilenameWithoutExtension(){ | ||
assertEquals("something", FilesManager.getFileWithoutExtension(new File("/something.test"))); | ||
} | ||
|
||
|
||
} |