class TableInfo {

    public String getFileName(String entityName, String value, Supplier<String> defaultValue) {
        return StringUtils.isNotBlank(value) ? String.format(value, entityName) : defaultValue.get();
    }

}

class TableInfoTest {

    @Test
    void getFileNameTest() {

        TableInfo tableInfo = new TableInfo();
        Assertions.assertEquals("UserEntity", tableInfo.getFileName("User", "", () -> "UserEntity"));
        Assertions.assertEquals("UserEntity", tableInfo.getFileName("User", null, () -> "UserEntity"));
        Assertions.assertEquals("UserTable", tableInfo.getFileName("User", "%sTable", () -> "UserEntity"));
        Assertions.assertEquals("UserTable", tableInfo.getFileName("User", "UserTable", () -> "UserEntity"));
    }

}