mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
tests: added some missing null checks
This commit is contained in:
parent
eed9e7069f
commit
48384a7ad0
@ -30,6 +30,8 @@
|
||||
package processing.app.tools;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
@ -57,11 +59,17 @@ public class ZipDeflaterTest {
|
||||
new ZipDeflater(file, destFolder).deflate();
|
||||
|
||||
String[] files = destFolder.list();
|
||||
assertNotNull(files);
|
||||
assertEquals(1, files.length);
|
||||
assertEquals("Test2", files[0]);
|
||||
|
||||
file = destFolder.listFiles()[0];
|
||||
File[] destFolders = destFolder.listFiles();
|
||||
assertNotNull(destFolders);
|
||||
assertTrue(destFolders.length > 0);
|
||||
file = destFolders[0];
|
||||
assertNotNull(file);
|
||||
files = file.list();
|
||||
assertNotNull(files);
|
||||
assertEquals(5, files.length);
|
||||
Arrays.sort(files);
|
||||
assertEquals("Test.cpp", files[0]);
|
||||
@ -77,11 +85,17 @@ public class ZipDeflaterTest {
|
||||
new ZipDeflater(file, destFolder).deflate();
|
||||
|
||||
String[] files = destFolder.list();
|
||||
assertNotNull(files);
|
||||
assertEquals(1, files.length);
|
||||
assertEquals("Test", files[0]);
|
||||
|
||||
file = destFolder.listFiles()[0];
|
||||
File[] destFolders = destFolder.listFiles();
|
||||
assertNotNull(destFolders);
|
||||
assertTrue(destFolders.length > 0);
|
||||
file = destFolders[0];
|
||||
assertNotNull(file);
|
||||
files = file.list();
|
||||
assertNotNull(files);
|
||||
assertEquals(5, files.length);
|
||||
Arrays.sort(files);
|
||||
assertEquals("Test.cpp", files[0]);
|
||||
@ -97,11 +111,17 @@ public class ZipDeflaterTest {
|
||||
new ZipDeflater(file, destFolder).deflate();
|
||||
|
||||
String[] files = destFolder.list();
|
||||
assertNotNull(files);
|
||||
assertEquals(1, files.length);
|
||||
assertEquals("Keypad", files[0]);
|
||||
|
||||
file = destFolder.listFiles()[0];
|
||||
File[] destFolders = destFolder.listFiles();
|
||||
assertNotNull(destFolders);
|
||||
assertTrue(destFolders.length > 0);
|
||||
file = destFolders[0];
|
||||
assertNotNull(file);
|
||||
files = file.list();
|
||||
assertNotNull(files);
|
||||
assertEquals(4, files.length);
|
||||
Arrays.sort(files);
|
||||
assertEquals("Keypad.cpp", files[0]);
|
||||
@ -110,6 +130,7 @@ public class ZipDeflaterTest {
|
||||
assertEquals("keywords.txt", files[3]);
|
||||
|
||||
files = new File(file, "examples").list();
|
||||
assertNotNull(files);
|
||||
assertEquals(4, files.length);
|
||||
Arrays.sort(files);
|
||||
assertEquals("CustomKeypad", files[0]);
|
||||
@ -124,11 +145,17 @@ public class ZipDeflaterTest {
|
||||
new ZipDeflater(file, destFolder).deflate();
|
||||
|
||||
String[] files = destFolder.list();
|
||||
assertNotNull(files);
|
||||
assertEquals(1, files.length);
|
||||
assertEquals("Keypad_with_hidden_files", files[0]);
|
||||
|
||||
file = destFolder.listFiles()[0];
|
||||
File[] destFolders = destFolder.listFiles();
|
||||
assertNotNull(destFolders);
|
||||
assertTrue(destFolders.length > 0);
|
||||
file = destFolders[0];
|
||||
assertNotNull(file);
|
||||
files = file.list();
|
||||
assertNotNull(files);
|
||||
assertEquals(4, files.length);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user