blob: 2f11dfc410ba8be1aa47b1d4c678ec7ad68bcc5f (
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
30
31
32
33
34
35
36
37
|
package cgeo.geocaching.enumerations;
import android.test.AndroidTestCase;
import java.util.Locale;
public class CacheSizeTest extends AndroidTestCase {
public static void testOrder() {
assertTrue(CacheSize.MICRO.comparable < CacheSize.SMALL.comparable);
assertTrue(CacheSize.SMALL.comparable < CacheSize.REGULAR.comparable);
assertTrue(CacheSize.REGULAR.comparable < CacheSize.LARGE.comparable);
}
public static void testGetById() {
assertEquals(CacheSize.UNKNOWN, CacheSize.getById(""));
assertEquals(CacheSize.UNKNOWN, CacheSize.getById(null));
assertEquals(CacheSize.UNKNOWN, CacheSize.getById("random garbage"));
assertEquals(CacheSize.LARGE, CacheSize.getById("large"));
assertEquals(CacheSize.LARGE, CacheSize.getById("LARGE"));
}
public static void testGetByIdComplete() {
for (CacheSize size : CacheSize.values()) {
assertEquals(size, CacheSize.getById(size.id));
assertEquals(size, CacheSize.getById(size.id.toLowerCase(Locale.US)));
assertEquals(size, CacheSize.getById(size.id.toUpperCase(Locale.US)));
}
}
public static void testGetByIdNumeric() {
assertEquals(CacheSize.REGULAR, CacheSize.getById("3"));
assertEquals(CacheSize.UNKNOWN, CacheSize.getById("0"));
assertEquals(CacheSize.UNKNOWN, CacheSize.getById("9"));
assertEquals(CacheSize.UNKNOWN, CacheSize.getById("-1"));
}
}
|