Skip to content

Commit 011e589

Browse files
committed
LPD-24481 test: simplify assertion
1 parent c14624c commit 011e589

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

cli/src/test/java/com/liferay/blade/cli/command/InitCommandTest.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -581,20 +581,15 @@ private void _testDefaultInitWorkspaceInWorkspace(String subworkspaceBaseDirName
581581
"--base", String.valueOf(subworkspacePath), "init", "-v", BladeTest.PRODUCT_VERSION_PORTAL_74
582582
};
583583

584-
try {
585-
BladeTestResults bladeTestResults = TestUtil.runBlade(_workspaceDir, _extensionsDir, moreArgs);
584+
BladeTestResults bladeTestResults = TestUtil.runBlade(_workspaceDir, _extensionsDir, false, moreArgs);
586585

587-
Assert.assertNull(
588-
"There should be no results from the command, but bladeTestResults != null)", bladeTestResults);
589-
}
590-
catch (AssertionError e) {
591-
String message = e.getMessage();
586+
String errorMessage = bladeTestResults.getErrors();
592587

593-
Assert.assertTrue(
594-
"should say 'does not support initializing a workspace inside of another workspace', but says: " +
595-
message,
596-
message.contains("does not support initializing a workspace inside of another workspace"));
597-
}
588+
String expectedErrorMessage = "does not support initializing a workspace inside of another workspace";
589+
590+
Assert.assertTrue(
591+
"should say '" + expectedErrorMessage + "', but says: " + errorMessage,
592+
errorMessage.contains(expectedErrorMessage));
598593
}
599594

600595
private void _testInitWithLiferayVersion(String liferayVersion) throws Exception {

0 commit comments

Comments
 (0)