aboutsummaryrefslogtreecommitdiff
path: root/resources/src/test/java/org/robolectric/res/android/AssetDirTest.java
blob: 4337fde56690f5224161363ea8d05143c54e2020 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package org.robolectric.res.android;

import static com.google.common.truth.Truth.assertThat;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public final class AssetDirTest {

  @Test
  public void getFileCount_returnsZeroIfInitializedTrivially() {
    assertThat(new AssetDir().getFileCount()).isEqualTo(0);
  }

  @Test
  public void getFileCount_returnsCorrectFileCount() {
    AssetDir.FileInfo fileInfo1 = new AssetDir.FileInfo(new String8("a/a.txt"));
    AssetDir.FileInfo fileInfo2 = new AssetDir.FileInfo(new String8("b/b.txt"));
    SortedVector<AssetDir.FileInfo> fileInfos = new SortedVector<>();
    fileInfos.add(fileInfo1);
    fileInfos.add(fileInfo2);
    AssetDir assetDir = new AssetDir();
    assetDir.setFileList(fileInfos);

    assertThat(assetDir.getFileCount()).isEqualTo(2);
  }
}