azkaban-aplcache
Changes
azkaban-common/build.gradle 1(+1 -0)
Details
azkaban-common/build.gradle 1(+1 -0)
diff --git a/azkaban-common/build.gradle b/azkaban-common/build.gradle
index eabcff2..f9fe39e 100644
--- a/azkaban-common/build.gradle
+++ b/azkaban-common/build.gradle
@@ -69,6 +69,7 @@ dependencies {
testCompile('org.hamcrest:hamcrest-all:1.3')
testCompile('org.mockito:mockito-all:1.10.19')
testCompile(project(':azkaban-test').sourceSets.test.output)
+ testCompile('org.assertj:assertj-core:3.8.0')
testRuntime('com.h2database:h2:1.4.193')
testRuntime('org.slf4j:slf4j-log4j12:1.7.18')
diff --git a/azkaban-common/src/test/java/azkaban/executor/mail/DefaultMailCreatorTest.java b/azkaban-common/src/test/java/azkaban/executor/mail/DefaultMailCreatorTest.java
index 7a940b3..d3ed6e7 100644
--- a/azkaban-common/src/test/java/azkaban/executor/mail/DefaultMailCreatorTest.java
+++ b/azkaban-common/src/test/java/azkaban/executor/mail/DefaultMailCreatorTest.java
@@ -1,5 +1,6 @@
package azkaban.executor.mail;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -96,8 +97,7 @@ public class DefaultMailCreatorTest {
this.executableFlow, this.message, this.azkabanName, this.scheme, this.clientHostname,
this.clientPortNumber));
assertEquals("Flow 'mail-creator-test' has failed on unit-tests", this.message.getSubject());
- assertEquals(read("errorEmail.html").replaceAll("\\s+", ""),
- this.message.getBody().replaceAll("\\s+", ""));
+ assertThat(read("errorEmail.html")).isEqualToIgnoringWhitespace(this.message.getBody());
}
@Test
@@ -109,8 +109,7 @@ public class DefaultMailCreatorTest {
this.clientPortNumber));
assertEquals("Flow 'mail-creator-test' has encountered a failure on unit-tests",
this.message.getSubject());
- assertEquals(read("firstErrorMessage.html").replaceAll("\\s+", ""),
- this.message.getBody().replaceAll("\\s+", ""));
+ assertThat(read("firstErrorMessage.html")).isEqualToIgnoringWhitespace(this.message.getBody());
}
@Test
@@ -122,8 +121,7 @@ public class DefaultMailCreatorTest {
this.executableFlow, this.message, this.azkabanName, this.scheme, this.clientHostname,
this.clientPortNumber));
assertEquals("Flow 'mail-creator-test' has succeeded on unit-tests", this.message.getSubject());
- assertEquals(read("successEmail.html").replaceAll("\\s+", ""),
- this.message.getBody().replaceAll("\\s+", ""));
+ assertThat(read("successEmail.html")).isEqualToIgnoringWhitespace(this.message.getBody());
}
private String read(final String file) throws Exception {
diff --git a/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutionFlowViewTest.java b/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutionFlowViewTest.java
index 4a33cf4..7717717 100644
--- a/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutionFlowViewTest.java
+++ b/azkaban-web-server/src/test/java/azkaban/webapp/servlet/ExecutionFlowViewTest.java
@@ -17,6 +17,12 @@ public class ExecutionFlowViewTest {
+ "class=\"btn btn-info btn-sm\" type=\"button\" target=\"_blank\" "
+ "title=\"Analyze job in Dr. Elephant\">Dr. Elephant</a></li>";
+ private static boolean ignoreCaseContains(final String source, final String target) {
+ final String sourceNoSpace = source.replaceAll("\\s+", "");
+ final String targetNoSpace = target.replaceAll("\\s+", "");
+ return sourceNoSpace.contains(targetNoSpace);
+ }
+
/**
* Test aims to check that the external analyzer button is displayed
* in the page.
@@ -35,8 +41,7 @@ public class ExecutionFlowViewTest {
context.put("flowid", 27);
final String result =
- VelocityTemplateTestUtil.renderTemplate("executingflowpage", context)
- .replaceAll("\\s+", "");
- assertTrue(result.contains(EXTERNAL_ANALYZER_ELEMENT.replaceAll("\\s+", "")));
+ VelocityTemplateTestUtil.renderTemplate("executingflowpage", context);
+ assertTrue(ignoreCaseContains(result, EXTERNAL_ANALYZER_ELEMENT));
}
}