Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/test/java/com/contentstack/sdk/TestContentType.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void testPrivateAccess() {
try {
new ContentType();
} catch (IllegalAccessException e) {
Assertions.assertEquals("Can Not Access Private Modifier", e.getLocalizedMessage());
Assertions.assertEquals("Direct instantiation of ContentType is not allowed. Use Stack.contentType(uid) to create an instance.", e.getLocalizedMessage());
logger.info("passed...");
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/contentstack/sdk/TestContentstack.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void initStackPrivateModifier() {
new Contentstack();
} catch (Exception e) {
logger.info(e.getLocalizedMessage());
Assertions.assertEquals("Can Not Access Private Modifier", e.getLocalizedMessage());
Assertions.assertEquals("Direct instantiation of Stack is not allowed. Use Contentstack.stack() to create an instance.", e.getLocalizedMessage());
}
}

Expand Down Expand Up @@ -67,7 +67,7 @@ void initStackWithEmptyAPIKey() {
Contentstack.stack("", DELIVERY_TOKEN, ENV);
} catch (Exception e) {
logger.info(e.getLocalizedMessage());
Assertions.assertEquals("API Key can not be empty", e.getLocalizedMessage(), "Set APIKey Null");
Assertions.assertEquals("Missing API key. Provide a valid key from your Contentstack stack settings and try again.", e.getLocalizedMessage(), "Set APIKey Null");
}
}

Expand All @@ -77,7 +77,7 @@ void initStackWithEmptyDeliveryToken() {
Contentstack.stack(API_KEY, "", ENV);
} catch (Exception e) {
logger.info(e.getLocalizedMessage());
Assertions.assertEquals("Delivery Token can not be empty", e.getLocalizedMessage(),
Assertions.assertEquals("Missing delivery token. Provide a valid token from your Contentstack stack settings and try again.", e.getLocalizedMessage(),
"Set deliveryToken Null");
}
}
Expand All @@ -88,7 +88,7 @@ void initStackWithEmptyEnvironment() {
Contentstack.stack(API_KEY, DELIVERY_TOKEN, "");
} catch (Exception e) {
logger.info(e.getLocalizedMessage());
Assertions.assertEquals("Environment can not be empty", e.getLocalizedMessage(), "Set Environment Null");
Assertions.assertEquals("Missing environment. Provide a valid environment name and try again.", e.getLocalizedMessage(), "Set Environment Null");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/contentstack/sdk/TestEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void entryCallingPrivateModifier() {
try {
new Entry();
} catch (IllegalAccessException e) {
Assertions.assertEquals("Can Not Access Private Modifier", e.getLocalizedMessage());
Assertions.assertEquals("Direct instantiation of Entry is not allowed. Use ContentType.entry(uid) to create an instance.", e.getLocalizedMessage());
logger.info("passed.");
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/contentstack/sdk/TestLivePreview.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void testLivePreviewWithoutPreviewToken() throws Exception {
stack.livePreviewQuery(hashMap);
}, "Expected livePreviewQuery to throw IllegalAccessError");

Assertions.assertTrue(thrown.getMessage().contains("Provide the Preview Token for the host rest-preview.contentstack.com"),
Assertions.assertTrue(thrown.getMessage().contains("Missing preview token for rest-preview.contentstack.com"),
"Exception message should mention that Preview Token is required");

logger.severe(thrown.getMessage());
Expand All @@ -220,7 +220,7 @@ void testLivePreviewDisabled() throws IllegalAccessException, IOException {
});

// Optionally, you can check the message of the exception
assertEquals("Live Preview is not enabled in Config", exception.getMessage(),
assertEquals("Live Preview is not enabled in the configuration. Enable it and try again.", exception.getMessage(),
"Expected exception message does not match");
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/java/com/contentstack/sdk/TestStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class TestStack {
@Order(1)
void stackExceptionTesting() {
IllegalAccessException thrown = Assertions.assertThrows(IllegalAccessException.class, Stack::new,
"Can Not Access Private Modifier");
assertEquals("Can Not Access Private Modifier", thrown.getLocalizedMessage());
"Direct instantiation of Stack is not allowed. Use Contentstack.stack() to create an instance.");
assertEquals("Direct instantiation of Stack is not allowed. Use Contentstack.stack() to create an instance.", thrown.getLocalizedMessage());
}

@Test
Expand All @@ -35,7 +35,7 @@ void testStackInitThrowErr() {
try {
stack = new Stack();
} catch (IllegalAccessException e) {
assertEquals("Can Not Access Private Modifier", e.getLocalizedMessage());
assertEquals("Direct instantiation of Stack is not allowed. Use Contentstack.stack() to create an instance.", e.getLocalizedMessage());
}
}

Expand Down
Loading