You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2019/07/27 09:05:07 UTC
[servicecomb-toolkit] 04/04: add some information which case
failure in the fail method
This is an automated email from the ASF dual-hosted git repository.
ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-toolkit.git
commit 00e9663030f8fb1554c8d3a4a5e2806a76686a95
Author: MabinGo <bi...@huawei.com>
AuthorDate: Sat Jul 27 16:57:57 2019 +0800
add some information which case failure in the fail method
Signed-off-by: MabinGo <bi...@huawei.com>
---
.../java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java | 3 ++-
.../java/org/apache/servicecomb/toolkit/common/FileUtilsTest.java | 2 +-
.../toolkit/contractgen/DefaultContractsGeneratorTest.java | 2 +-
.../org/apache/servicecomb/toolkit/plugin/GenerateMojoTest.java | 4 ++--
.../org/apache/servicecomb/toolkit/plugin/GenerateUtilTest.java | 6 +++---
5 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/codegen/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java b/codegen/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
index 378554e..c54bed2 100755
--- a/codegen/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
+++ b/codegen/src/test/java/org/apache/servicecomb/toolkit/codegen/GeneratorTest.java
@@ -62,7 +62,8 @@ public class GeneratorTest {
try {
codeGenerator.generate();
} catch (RuntimeException e) {
- fail();
+ fail("Run 'generateProgrammingModels' failed while input " + programmingModel + " unexpected to catch RuntimeException: " + e
+ .getMessage());
}
Object internalGenerator = ReflectUtils.getProperty(codeGenerator, "generator");
diff --git a/common/src/test/java/org/apache/servicecomb/toolkit/common/FileUtilsTest.java b/common/src/test/java/org/apache/servicecomb/toolkit/common/FileUtilsTest.java
index 533b65b..2a16016 100755
--- a/common/src/test/java/org/apache/servicecomb/toolkit/common/FileUtilsTest.java
+++ b/common/src/test/java/org/apache/servicecomb/toolkit/common/FileUtilsTest.java
@@ -43,7 +43,7 @@ public class FileUtilsTest {
path = Files.createTempDirectory("");
FileUtils.createDirectory(path.toFile().getCanonicalPath());
} catch (IOException e) {
- fail();
+ fail("Run 'createDirectoryTest' failed and unexpected to catch IOException: " + e.getMessage());
}
}
diff --git a/contractgen/src/test/java/org/apache/servicecomb/toolkit/contractgen/DefaultContractsGeneratorTest.java b/contractgen/src/test/java/org/apache/servicecomb/toolkit/contractgen/DefaultContractsGeneratorTest.java
index 7f0850a..0d48468 100644
--- a/contractgen/src/test/java/org/apache/servicecomb/toolkit/contractgen/DefaultContractsGeneratorTest.java
+++ b/contractgen/src/test/java/org/apache/servicecomb/toolkit/contractgen/DefaultContractsGeneratorTest.java
@@ -89,7 +89,7 @@ public class DefaultContractsGeneratorTest {
try {
defaultContractsGenerator.generate();
} catch (RuntimeException e) {
- fail();
+ fail("Run 'testGenerate' failed and unexpected to catch RuntimeException: " + e.getMessage());
}
}
diff --git a/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateMojoTest.java b/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateMojoTest.java
index de47ebb..656dbf6 100755
--- a/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateMojoTest.java
+++ b/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateMojoTest.java
@@ -99,7 +99,7 @@ public class GenerateMojoTest {
assertEquals(0, Objects.requireNonNull(
new File(rule.getVariableValueFromObject(generateMojo, "contractLocation").toString()).listFiles()).length);
} catch (MojoFailureException e) {
- fail();
+ fail("Run 'testGenerateMojo' failed and unexpected to catch MojoFailureException: " + e.getMessage());
}
// code has contract
@@ -129,7 +129,7 @@ public class GenerateMojoTest {
assertNotEquals(0, Objects.requireNonNull(new File(projectOutput).listFiles()).length);
assertNotEquals(0, Objects.requireNonNull(new File(documentOutput).listFiles()).length);
} catch (RuntimeException e) {
- fail();
+ fail("Run 'testGenerateMojo' failed and unexpected to catch RuntimeException: " + e.getMessage());
}
boolean isSuccessful;
diff --git a/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateUtilTest.java b/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateUtilTest.java
index 69fcdf8..0fa4ef1 100755
--- a/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateUtilTest.java
+++ b/toolkit-maven-plugin/src/test/java/org/apache/servicecomb/toolkit/plugin/GenerateUtilTest.java
@@ -61,7 +61,7 @@ public class GenerateUtilTest {
return;
}
- fail();
+ fail("Run 'testGenerateContract' failed, expected to catch RuntimeException but not");
}
@Test
@@ -80,7 +80,7 @@ public class GenerateUtilTest {
return;
}
- fail();
+ fail("Run 'testGenerateCode' failed, expected to catch RuntimeException but not");
}
@Test
@@ -98,6 +98,6 @@ public class GenerateUtilTest {
return;
}
- fail();
+ fail("Run 'testGenerateDocument' failed, expected to catch RuntimeException but not");
}
}
\ No newline at end of file