增加formatPackageRegx

This commit is contained in:
redkale
2024-06-21 10:50:23 +08:00
parent ca06085dfb
commit 52cf34ba29
2 changed files with 58 additions and 12 deletions

View File

@@ -0,0 +1,40 @@
/*
*/
package org.redkale.test.util;
import org.junit.jupiter.api.*;
import org.redkale.boot.ClassFilter;
/**
*
* @author zhangjx
*/
public class ClassFilterTest {
public static void main(String[] args) throws Throwable {
ClassFilterTest test = new ClassFilterTest();
test.run1();
test.run2();
test.run3();
}
@Test
public void run1() {
String regx = ClassFilter.formatPackageRegx("*.platf.**");
Assertions.assertEquals("^(\\w+)\\.platf\\.(.*)$", regx);
}
@Test
public void run2() {
String regx = ClassFilter.formatPackageRegx("com.platf.**.api");
Assertions.assertEquals("^com\\.platf\\.(.*)\\.api$", regx);
}
@Test
public void run3() {
String regx = ClassFilter.formatPackageRegx("**.platf.api");
Assertions.assertEquals("^(.*)\\.platf\\.api$", regx);
}
}