|
14 | 14 | @ExtendWith(MockitoExtension.class) |
15 | 15 | class TestExecutorTest { |
16 | 16 |
|
17 | | - private static final String TEST_USERNAME = "testuser"; |
18 | | - private static final String TEST_ACCESS_KEY = "test_access_key"; |
19 | | - private static final String TEST_APP_ID = "lt://APP1234567890"; |
20 | | - private static final String TEST_SUITE_ID = "lt://APP1234567891"; |
21 | | - private static final List<String> TEST_DEVICES = Arrays.asList("Pixel 6-12", "Galaxy S21-11"); |
| 17 | + private static final String TEST_USERNAME = "testuser"; |
| 18 | + private static final String TEST_ACCESS_KEY = "test_access_key"; |
| 19 | + private static final String TEST_APP_ID = "lt://APP1234567890"; |
| 20 | + private static final String TEST_SUITE_ID = "lt://APP1234567891"; |
| 21 | + private static final List<String> TEST_DEVICES = Arrays.asList("Pixel 6-12", "Galaxy S21-11"); |
22 | 22 |
|
23 | | - @Test |
24 | | - void constructor_ShouldCreateInstance_WithValidParameters() { |
25 | | - // Test standard Android app |
26 | | - TestExecutor executor = new TestExecutor( |
27 | | - TEST_USERNAME, TEST_ACCESS_KEY, TEST_APP_ID, TEST_SUITE_ID, TEST_DEVICES, false); |
28 | | - assertThat(executor).isNotNull(); |
| 23 | + @Test |
| 24 | + void constructor_ShouldCreateInstance_WithValidParameters() { |
| 25 | + // Test standard Android app |
| 26 | + TestExecutor executor = |
| 27 | + new TestExecutor( |
| 28 | + TEST_USERNAME, |
| 29 | + TEST_ACCESS_KEY, |
| 30 | + TEST_APP_ID, |
| 31 | + TEST_SUITE_ID, |
| 32 | + TEST_DEVICES, |
| 33 | + false); |
| 34 | + assertThat(executor).isNotNull(); |
29 | 35 |
|
30 | | - // Test Flutter app |
31 | | - TestExecutor flutterExecutor = new TestExecutor( |
32 | | - TEST_USERNAME, TEST_ACCESS_KEY, TEST_APP_ID, TEST_SUITE_ID, TEST_DEVICES, true); |
33 | | - assertThat(flutterExecutor).isNotNull(); |
| 36 | + // Test Flutter app |
| 37 | + TestExecutor flutterExecutor = |
| 38 | + new TestExecutor( |
| 39 | + TEST_USERNAME, |
| 40 | + TEST_ACCESS_KEY, |
| 41 | + TEST_APP_ID, |
| 42 | + TEST_SUITE_ID, |
| 43 | + TEST_DEVICES, |
| 44 | + true); |
| 45 | + assertThat(flutterExecutor).isNotNull(); |
34 | 46 |
|
35 | | - // Test null Flutter parameter (should default to false) |
36 | | - TestExecutor nullFlutterExecutor = new TestExecutor( |
37 | | - TEST_USERNAME, TEST_ACCESS_KEY, TEST_APP_ID, TEST_SUITE_ID, TEST_DEVICES, null); |
38 | | - assertThat(nullFlutterExecutor).isNotNull(); |
39 | | - } |
| 47 | + // Test null Flutter parameter (should default to false) |
| 48 | + TestExecutor nullFlutterExecutor = |
| 49 | + new TestExecutor( |
| 50 | + TEST_USERNAME, |
| 51 | + TEST_ACCESS_KEY, |
| 52 | + TEST_APP_ID, |
| 53 | + TEST_SUITE_ID, |
| 54 | + TEST_DEVICES, |
| 55 | + null); |
| 56 | + assertThat(nullFlutterExecutor).isNotNull(); |
| 57 | + } |
40 | 58 |
|
41 | | - @Test |
42 | | - void executeTests_ShouldHandleParametersCorrectly() { |
43 | | - // Given |
44 | | - TestExecutor executor = new TestExecutor( |
45 | | - TEST_USERNAME, TEST_ACCESS_KEY, TEST_APP_ID, TEST_SUITE_ID, TEST_DEVICES, false); |
| 59 | + @Test |
| 60 | + void executeTests_ShouldHandleParametersCorrectly() { |
| 61 | + // Given |
| 62 | + TestExecutor executor = |
| 63 | + new TestExecutor( |
| 64 | + TEST_USERNAME, |
| 65 | + TEST_ACCESS_KEY, |
| 66 | + TEST_APP_ID, |
| 67 | + TEST_SUITE_ID, |
| 68 | + TEST_DEVICES, |
| 69 | + false); |
46 | 70 |
|
47 | | - Map<String, String> params = new HashMap<>(); |
48 | | - params.put("build", "Test Build"); |
49 | | - params.put("video", "true"); |
50 | | - params.put("deviceLog", "true"); |
| 71 | + Map<String, String> params = new HashMap<>(); |
| 72 | + params.put("build", "Test Build"); |
| 73 | + params.put("video", "true"); |
| 74 | + params.put("deviceLog", "true"); |
51 | 75 |
|
52 | | - // When/Then - Should not throw during parameter setup |
53 | | - // Note: Actual HTTP execution will fail in tests, which is expected |
54 | | - assertThat(params).containsEntry("build", "Test Build"); |
55 | | - assertThat(params).containsEntry("video", "true"); |
56 | | - assertThat(executor).isNotNull(); |
57 | | - } |
| 76 | + // When/Then - Should not throw during parameter setup |
| 77 | + // Note: Actual HTTP execution will fail in tests, which is expected |
| 78 | + assertThat(params).containsEntry("build", "Test Build"); |
| 79 | + assertThat(params).containsEntry("video", "true"); |
| 80 | + assertThat(executor).isNotNull(); |
| 81 | + } |
58 | 82 |
|
59 | | - @Test |
60 | | - void executeTests_ShouldHandleEmptyParameters() { |
61 | | - // Given |
62 | | - TestExecutor executor = new TestExecutor( |
63 | | - TEST_USERNAME, TEST_ACCESS_KEY, TEST_APP_ID, TEST_SUITE_ID, TEST_DEVICES, false); |
| 83 | + @Test |
| 84 | + void executeTests_ShouldHandleEmptyParameters() { |
| 85 | + // Given |
| 86 | + TestExecutor executor = |
| 87 | + new TestExecutor( |
| 88 | + TEST_USERNAME, |
| 89 | + TEST_ACCESS_KEY, |
| 90 | + TEST_APP_ID, |
| 91 | + TEST_SUITE_ID, |
| 92 | + TEST_DEVICES, |
| 93 | + false); |
64 | 94 |
|
65 | | - Map<String, String> emptyParams = new HashMap<>(); |
| 95 | + Map<String, String> emptyParams = new HashMap<>(); |
66 | 96 |
|
67 | | - // When/Then - Should handle empty parameters without issues |
68 | | - assertThat(emptyParams).isEmpty(); |
69 | | - assertThat(executor).isNotNull(); |
70 | | - } |
| 97 | + // When/Then - Should handle empty parameters without issues |
| 98 | + assertThat(emptyParams).isEmpty(); |
| 99 | + assertThat(executor).isNotNull(); |
| 100 | + } |
71 | 101 |
|
72 | | - @Test |
73 | | - void constructor_ShouldHandleDeviceVariations() { |
74 | | - // Single device |
75 | | - List<String> singleDevice = Arrays.asList("Pixel 6-12"); |
76 | | - TestExecutor singleDeviceExecutor = new TestExecutor( |
77 | | - TEST_USERNAME, TEST_ACCESS_KEY, TEST_APP_ID, TEST_SUITE_ID, singleDevice, false); |
78 | | - assertThat(singleDeviceExecutor).isNotNull(); |
| 102 | + @Test |
| 103 | + void constructor_ShouldHandleDeviceVariations() { |
| 104 | + // Single device |
| 105 | + List<String> singleDevice = Arrays.asList("Pixel 6-12"); |
| 106 | + TestExecutor singleDeviceExecutor = |
| 107 | + new TestExecutor( |
| 108 | + TEST_USERNAME, |
| 109 | + TEST_ACCESS_KEY, |
| 110 | + TEST_APP_ID, |
| 111 | + TEST_SUITE_ID, |
| 112 | + singleDevice, |
| 113 | + false); |
| 114 | + assertThat(singleDeviceExecutor).isNotNull(); |
79 | 115 |
|
80 | | - // Multiple devices |
81 | | - List<String> multipleDevices = Arrays.asList("Pixel 6-12", "Galaxy S21-11", "iPhone 13-15"); |
82 | | - TestExecutor multiDeviceExecutor = new TestExecutor( |
83 | | - TEST_USERNAME, TEST_ACCESS_KEY, TEST_APP_ID, TEST_SUITE_ID, multipleDevices, false); |
84 | | - assertThat(multiDeviceExecutor).isNotNull(); |
85 | | - } |
| 116 | + // Multiple devices |
| 117 | + List<String> multipleDevices = Arrays.asList("Pixel 6-12", "Galaxy S21-11", "iPhone 13-15"); |
| 118 | + TestExecutor multiDeviceExecutor = |
| 119 | + new TestExecutor( |
| 120 | + TEST_USERNAME, |
| 121 | + TEST_ACCESS_KEY, |
| 122 | + TEST_APP_ID, |
| 123 | + TEST_SUITE_ID, |
| 124 | + multipleDevices, |
| 125 | + false); |
| 126 | + assertThat(multiDeviceExecutor).isNotNull(); |
| 127 | + } |
86 | 128 | } |
0 commit comments