Skip to content

Commit

Permalink
errorprone :: ConstantPatternCompile (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-mlb committed May 29, 2024
1 parent 7337fef commit 070fa21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/test/java/emissary/core/IBaseDataObjectHelperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class IBaseDataObjectHelperTest extends UnitTest {
private static final Boolean DONT_CHECK = null;
private static final Boolean EQUAL_WITHOUT_FULL_CLONE = false;
private static final Boolean EQUAL_AFTER_FULL_CLONE = true;
private static final Pattern EXCLUDED_PARAMETERS = Pattern.compile("FILETYPE|WILDCARDED_.*");

@BeforeEach
void setup() {
Expand Down Expand Up @@ -353,16 +354,15 @@ void testAddParentInformationToChildren() {
void testAddParentInformationToChildExcluding() throws Exception {
final IBaseDataObject parentIbdo = ibdo1;
final IBaseDataObject childIbdo = ibdo2;
final Pattern excludedParameters = Pattern.compile("FILETYPE|WILDCARDED_.*");

checkThrowsNull(() -> IBaseDataObjectHelper.addParentInformationToChildExcluding(null, childIbdo, excludedParameters));
checkThrowsNull(() -> IBaseDataObjectHelper.addParentInformationToChildExcluding(parentIbdo, null, excludedParameters));
checkThrowsNull(() -> IBaseDataObjectHelper.addParentInformationToChildExcluding(null, childIbdo, EXCLUDED_PARAMETERS));
checkThrowsNull(() -> IBaseDataObjectHelper.addParentInformationToChildExcluding(parentIbdo, null, EXCLUDED_PARAMETERS));
checkThrowsNull(() -> IBaseDataObjectHelper.addParentInformationToChildExcluding(parentIbdo, childIbdo, null));

parentIbdo.setFileType("filetype");
parentIbdo.setParameter("NON_EXCLUDED", "hereIam");
parentIbdo.setParameter("WILDCARDED_KEYNAME", "anyValueWillDo");
IBaseDataObjectHelper.addParentInformationToChildExcluding(parentIbdo, childIbdo, excludedParameters);
IBaseDataObjectHelper.addParentInformationToChildExcluding(parentIbdo, childIbdo, EXCLUDED_PARAMETERS);
assertNull(childIbdo.getFileType(), "Child should not contain simple excluded parameter from parent");
assertNull(childIbdo.getParameter("WILDCARDED_KEYNAME"), "Child should not contain wildcard excluded parameter from parent");
assertEquals(parentIbdo.getParameter("NON_EXCLUDED").get(0), childIbdo.getParameter("NON_EXCLUDED").get(0),
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/emissary/output/DropOffUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
* Tests for DropOffUtil
*/
class DropOffUtilTest extends UnitTest {
private static final Pattern SUBDIR_NAME_PATTERN = Pattern.compile("NO-CASE/\\d{4}-\\d{2}-\\d{2}/\\d{2}/\\d{2}");
@Nullable
private DropOffUtil util = null;
@Nullable
Expand Down Expand Up @@ -485,7 +486,7 @@ void testGetEventDate() {
@Test
void testGetSubdirName() {
String subdirName = this.util.getSubDirName(new BaseDataObject(), null, new BaseDataObject());
assertTrue(Pattern.compile("NO-CASE/\\d{4}-\\d{2}-\\d{2}/\\d{2}/\\d{2}").matcher(subdirName).matches());
assertTrue(SUBDIR_NAME_PATTERN.matcher(subdirName).matches());
}

@Test
Expand Down

0 comments on commit 070fa21

Please sign in to comment.