-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update junit 4.12 to 4.13.1 to remove security warning.
This also involved replacing the deprecated org.junit.Assert.assertThat with org.hamcrest.MatcherAssert.assertThat. NOTE: The security issue in junit 4.12 (which relates to information disclosure using TemporaryFolder rule) does not affect this project so this update is mostly to appease security scanners.
- Loading branch information
Showing
18 changed files
with
53 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
openhtmltopdf-core/src/test/java/com/openhtmltopdf/layout/BreakerTestSupport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 16 additions & 15 deletions
31
openhtmltopdf-core/src/test/java/com/openhtmltopdf/util/ConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,73 @@ | ||
package com.openhtmltopdf.util; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import org.junit.Test; | ||
import static org.junit.Assert.*; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
import org.hamcrest.CoreMatchers; | ||
|
||
public class ConfigurationTest { | ||
|
||
@Test | ||
public void testValueFor() { | ||
String key = "xr.test-config-byte"; | ||
String value = Configuration.valueFor(key); | ||
assertThat(value, is("8")); | ||
assertThat(value, CoreMatchers.is("8")); | ||
} | ||
|
||
@Test | ||
public void testValueAsByte() { | ||
String key = "xr.test-config-byte"; | ||
int value = Configuration.valueAsByte(key, (byte) 0); | ||
assertThat(value, is(8)); | ||
assertThat(value, CoreMatchers.is(8)); | ||
} | ||
|
||
@Test | ||
public void testValueAsShort() { | ||
String key = "xr.test-config-short"; | ||
int value = Configuration.valueAsShort(key, (short) 0); | ||
assertThat(value, is(16)); | ||
assertThat(value, CoreMatchers.is(16)); | ||
} | ||
|
||
@Test | ||
public void testValueAsInt() { | ||
String key = "xr.test-config-int"; | ||
int value = Configuration.valueAsInt(key, (int) 0); | ||
assertThat(value, is(100)); | ||
int value = Configuration.valueAsInt(key, 0); | ||
assertThat(value, CoreMatchers.is(100)); | ||
} | ||
|
||
@Test | ||
public void testValueAsLong() { | ||
String key = "xr.test-config-long"; | ||
long value = Configuration.valueAsLong(key, (long) 0); | ||
assertThat(value, is(2000L)); | ||
long value = Configuration.valueAsLong(key, 0l); | ||
assertThat(value, CoreMatchers.is(2000L)); | ||
} | ||
|
||
@Test | ||
public void testValueAsFloat() { | ||
String key = "xr.test-config-float"; | ||
float value = Configuration.valueAsFloat(key, (float) 0); | ||
assertThat(value, is(3000.25F)); | ||
float value = Configuration.valueAsFloat(key, 0f); | ||
assertThat(value, CoreMatchers.is(3000.25F)); | ||
} | ||
|
||
@Test | ||
public void testValueAsDouble() { | ||
String key = "xr.test-config-double"; | ||
double value = Configuration.valueAsDouble(key, (double) 0); | ||
assertThat(value, is(4000.50D)); | ||
double value = Configuration.valueAsDouble(key, 0d); | ||
assertThat(value, CoreMatchers.is(4000.50D)); | ||
} | ||
|
||
@Test | ||
public void testIsTrue() { | ||
String key = "xr.test-config-boolean"; | ||
boolean value = Configuration.isTrue(key, false); | ||
assertThat(value, is(true)); | ||
assertThat(value, CoreMatchers.is(true)); | ||
} | ||
|
||
@Test | ||
public void testIsFalse() { | ||
String key = "xr.test-config-boolean"; | ||
boolean value = Configuration.isFalse(key, true); | ||
assertThat(value, is(false)); | ||
assertThat(value, CoreMatchers.is(false)); | ||
} | ||
|
||
} |
11 changes: 6 additions & 5 deletions
11
openhtmltopdf-core/src/test/java/com/openhtmltopdf/util/ImageUtilTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
package com.openhtmltopdf.util; | ||
|
||
import java.awt.image.BufferedImage; | ||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.CoreMatchers.notNullValue; | ||
|
||
import org.hamcrest.CoreMatchers; | ||
import org.junit.Test; | ||
import org.junit.Assert; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
public class ImageUtilTest { | ||
|
||
@Test | ||
public void testGetEmbeddedBase64Image() { | ||
String onePixel = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAACXBIWXMAAC4jAAAuIwF4pT92AAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC"; | ||
byte[] result = ImageUtil.getEmbeddedBase64Image(onePixel); | ||
Assert.assertThat(result, notNullValue()); | ||
assertThat(result, notNullValue()); | ||
} | ||
|
||
@Test | ||
public void testLoadEmbeddedBase64Image() { | ||
String onePixel = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAACXBIWXMAAC4jAAAuIwF4pT92AAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC"; | ||
BufferedImage result = ImageUtil.loadEmbeddedBase64Image(onePixel); | ||
Assert.assertThat(result.getHeight(), is(1)); | ||
Assert.assertThat(result.getWidth(), is(1)); | ||
assertThat(result.getHeight(), CoreMatchers.is(1)); | ||
assertThat(result.getWidth(), CoreMatchers.is(1)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...les/src/test/java/com/openhtmltopdf/nonvisualregressiontests/NonVisualRegressionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters