Skip to content

Commit 8b85986

Browse files
Vikram KaltaVikram Kalta
authored andcommitted
feat: added integration tests
1 parent 5fe94a8 commit 8b85986

File tree

7 files changed

+647
-576
lines changed

7 files changed

+647
-576
lines changed

contentstack/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ dependencies {
161161
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
162162
testImplementation 'junit:junit:4.13.2'
163163
androidTestImplementation 'androidx.test:core:1.5.0'
164+
testImplementation 'org.robolectric:robolectric:4.6.1'
165+
164166
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
165167
exclude group: 'com.android.support', module: 'support-annotations'
166168
})

contentstack/src/androidTest/java/com/contentstack/sdk/AssetTestCase.java

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,6 @@ public static void oneTimeSetUp() throws Exception {
3939
stack = Contentstack.stack(appContext, DEFAULT_API_KEY, DEFAULT_DELIVERY_TOKEN, DEFAULT_ENV, config);
4040
}
4141

42-
43-
@Test()
44-
public void test_A_getAllAssetsToSetAssetUID() {
45-
final AssetLibrary assetLibrary = stack.assetLibrary();
46-
assetLibrary.fetchAll(new FetchAssetsCallback() {
47-
@Override
48-
public void onCompletion(ResponseType responseType, List<Asset> assets, Error error) {
49-
if (error == null) {
50-
Log.d(TAG, "response: " + assets.get(0).getAssetUid());
51-
assetUid = assets.get(0).getAssetUid();
52-
Log.e(assetUid, assetUid);
53-
}
54-
}
55-
});
56-
57-
}
58-
5942
@Test
6043
public void test_B_VerifyAssetUID() {
6144
final Asset asset = stack.asset(assetUid);
@@ -89,28 +72,6 @@ public void onCompletion(ResponseType responseType, Error error) {
8972
});
9073
}
9174

92-
@Test
93-
public void test_D_AssetLibrary_fetch() {
94-
final AssetLibrary assetLibrary = stack.assetLibrary();
95-
assetLibrary.fetchAll(new FetchAssetsCallback() {
96-
@Override
97-
public void onCompletion(ResponseType responseType, List<Asset> assets, Error error) {
98-
if (error == null) {
99-
assets.forEach(asset -> {
100-
Log.d(TAG, "----Test--Asset-D--Success----" + asset.toJSON());
101-
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getFileType());
102-
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getCreatedBy());
103-
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getUpdatedBy());
104-
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getFileName());
105-
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getFileSize());
106-
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getAssetUid());
107-
Log.d(TAG, "----Test--Asset-D--Success----" + asset.getUrl());
108-
});
109-
}
110-
}
111-
});
112-
}
113-
11475
@Test
11576
public void test_E_AssetLibrary_includeCount_fetch() {
11677
final AssetLibrary assetLibrary = stack.assetLibrary();
@@ -195,21 +156,6 @@ public void test_GCP_NA() throws Exception {
195156
stack = Contentstack.stack(appContext, DEFAULT_API_KEY, DEFAULT_DELIVERY_TOKEN, DEFAULT_ENV, config);
196157
}
197158

198-
@Test
199-
public void test_I_fetch_asset_by_title() {
200-
final AssetLibrary assetLibrary = stack.assetLibrary().where("title", "iot-icon.png");
201-
assetLibrary.fetchAll(new FetchAssetsCallback() {
202-
@Override
203-
public void onCompletion(ResponseType responseType, List<Asset> assets, Error error) {
204-
if (error == null) {
205-
for (Asset asset : assets) {
206-
Log.d("RESULT:", "resp" + asset.json);
207-
}
208-
}
209-
}
210-
});
211-
}
212-
213159
@Test
214160
public void test_J_fetch_asset_by_tags() {
215161
final AssetLibrary assetLibrary = stack.assetLibrary().where("tags","tag1");
@@ -240,18 +186,6 @@ public void onCompletion(ResponseType responseType, List<Asset> assets, Error er
240186
});
241187
}
242188

243-
@Test
244-
public void test_L_fetch_asset_invalid() {
245-
final AssetLibrary assetLibrary = stack.assetLibrary().where("title",null);
246-
assetLibrary.fetchAll(new FetchAssetsCallback() {
247-
@Override
248-
public void onCompletion(ResponseType responseType, List<Asset> assets, Error error) {
249-
Log.e("RESULT:", "ERROR:"+ error.errorMessage);
250-
}
251-
});
252-
253-
}
254-
255189
@Test
256190
public void test_M_fetch_asset_empty_title() {
257191
final AssetLibrary assetLibrary = stack.assetLibrary().where("title","");

0 commit comments

Comments
 (0)