Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
minor cleanup
Signed-off-by: tobiasKaminsky <[email protected]>
  • Loading branch information
tobiasKaminsky committed Jul 23, 2019
commit 788b3e723b8f0dd41d3add8259c4bfad314b7ef7
13 changes: 7 additions & 6 deletions src/androidTest/java/com/owncloud/android/AbstractIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public abstract class AbstractIT {
private static final int BUFFER_SIZE = 1024;

protected static OwnCloudClient client;
protected static Context context;
private static Context context;

@BeforeClass
public static void beforeAll() {
Expand All @@ -55,7 +55,10 @@ public String createFile(String name) throws IOException {
File tempDir = context.getFilesDir();

File file = new File(tempDir + File.separator + name);
file.createNewFile();

if (!file.createNewFile()) {
throw new IOException("Cannot create file: " + file.getAbsolutePath());
}

assertTrue(file.exists());

Expand All @@ -72,10 +75,8 @@ public String createFile(String name) throws IOException {
public static File extractAsset(String fileName, Context context) throws IOException {
File extractedFile = new File(context.getCacheDir() + File.separator + fileName);
if (!extractedFile.exists()) {
InputStream in = null;
FileOutputStream out = null;
in = context.getAssets().open(fileName);
out = new FileOutputStream(extractedFile);
InputStream in = context.getAssets().open(fileName);
FileOutputStream out = new FileOutputStream(extractedFile);
byte[] buffer = new byte[BUFFER_SIZE];
int readCount;
while ((readCount = in.read(buffer)) != -1) {
Expand Down