kazurayam / materialstore

A domain-specific file system to store "materials" (screenshots, HTML, JSON, XML) collected during End-to-End testings using Selenium WebDriver etc. Features to make "diff" and compiling HTML reports are also included. This is written in pure Java8
Apache License 2.0
0 stars 0 forks source link

QueryOnMetadata that uses Regular Expression did not work #433

Closed kazurayam closed 1 year ago

kazurayam commented 1 year ago

I created in https://github.com/kazurayam/materialstore-tutorial/blob/develop/src/test/java/my/sample/T05SelectMaterialListTest.java

@Test
    public void test05_select_with_Regex() throws MaterialstoreException {
        JobName jobName = new JobName("test05_select_with_Regex");
        JobTimestamp jobTimestamp = JobTimestamp.now();
        SharedMethods.write3images(store, jobName, jobTimestamp);
        MaterialList materialList =
                store.select(jobName, jobTimestamp,
                        QueryOnMetadata.builder().put("label", "[a-z]+") // (21)
                                .build());
        assertEquals(2, materialList.size());
    }

I expected this test to pass, but it failed. The materialList.size() returned 0.

I specified a Regular Expression here:

QueryOnMetadata.builder().put("label", "[a-z]+")

It seems it does not work.

kazurayam commented 1 year ago

The following works

import java.util.regex.Pattern;
...
                        QueryOnMetadata.builder().put("label", Pattern.compile("[a-z]+")) // (21)
                                .build());