|
22 | 22 |
|
23 | 23 | import static org.awaitility.Awaitility.await; |
24 | 24 | import static org.junit.Assert.assertEquals; |
| 25 | +import static org.junit.Assert.assertFalse; |
25 | 26 |
|
26 | 27 | import java.io.File; |
27 | 28 | import java.util.List; |
|
43 | 44 | import androidx.test.filters.Suppress; |
44 | 45 | import androidx.test.platform.app.InstrumentationRegistry; |
45 | 46 |
|
| 47 | +import io.reactivex.Completable; |
| 48 | + |
46 | 49 | @RunWith(AndroidJUnit4.class) |
47 | 50 | public class UtilsHandlerTest { |
48 | 51 |
|
@@ -120,18 +123,19 @@ public void testRepeatedSaveBookmarkShouldNeverThrowException() { |
120 | 123 | private void performEncryptUriTest(@NonNull final String origPath) { |
121 | 124 | String encryptedPath = NetCopyClientUtils.INSTANCE.encryptFtpPathAsNecessary(origPath); |
122 | 125 |
|
123 | | - utilsHandler.saveToDatabase( |
124 | | - new OperationData( |
125 | | - UtilsHandler.Operation.SFTP, |
126 | | - encryptedPath, |
127 | | - "Test", |
128 | | - "00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff", |
129 | | - null, |
130 | | - null)); |
131 | | - |
132 | | - await().atMost(10, TimeUnit.SECONDS).until(() -> utilsHandler.getSftpList().size() > 0); |
133 | | - |
134 | | - List<String[]> result = utilsHandler.getSftpList(); |
| 126 | + final Completable operation = |
| 127 | + utilsHandler.saveToDatabase( |
| 128 | + new OperationData( |
| 129 | + UtilsHandler.Operation.SFTP, |
| 130 | + encryptedPath, |
| 131 | + "Test", |
| 132 | + "00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff", |
| 133 | + null, |
| 134 | + null)); |
| 135 | + operation.blockingAwait(); |
| 136 | + |
| 137 | + final List<String[]> result = utilsHandler.getSftpList(); |
| 138 | + assertFalse(result.isEmpty()); |
135 | 139 | assertEquals(1, result.size()); |
136 | 140 | assertEquals("Test", result.get(0)[0]); |
137 | 141 | assertEquals(encryptedPath, result.get(0)[1]); |
|
0 commit comments