Socket
Socket
Sign inDemoInstall

com.github.simy4.coregex:coregex-core

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.github.simy4.coregex:coregex-core

A handy utility for generating strings that match given regular expression criteria.


Version published
Maintainers
1
Source

coregex

Build Status codecov License

Maven Central Javadocs

A handy utility for generating strings that match given regular expression criteria.

Supported generators

Usage

Jqwik

Include the following dependency into your project:

testImplementation "com.github.simy4.coregex:coregex-jqwik"

Use the provided Regex annotation to generate a string that would match the regular expression predicate:

class MyTest {
  @Property
  void myProperty(@ForAll @Regex("[a-zA-Z]{3}") String str) {
    assertThat(str).hasLength(3);
  }
}

JUnit Quickcheck

Include the following dependency into your project:

testImplementation "com.github.simy4.coregex:coregex-junit-quickcheck"

Use the provided Regex annotation to generate a string that would match the regular expression predicate:

@RunWith(JUnitQuickcheck.class)
public class MyTest {
  @Property
  public void myProperty(@Regex("[a-zA-Z]{3}") String str) {
    assertThat(str).hasLength(3);
  }
}

Kotest

Include the following dependency into your project:

testImplementation "com.github.simy4.coregex:coregex-kotest"

Use the provided CoregexArbirary class to generate a string that would match the regular expression predicate:

class MyTest : DescribeSpec({
  describe("my property") {
    it("should hold") {
      checkAll(CoregexArbitrary.of("[a-zA-Z]{3}")) { str ->
        str.length shouldBe 3
      }
    }
  }
})

scalacheck

Include the following dependency into your project:

libraryDependencies ++= Seq("com.github.simy4.coregex" %% "coregex-scalacheck" % Test)

Use the provided CoregexInstances trait to constrain string arbitraries:

object MySpecification extends Properties("MySpecification") with CoregexInstances {
  property("my property") = forAll { (str: String Matching "[a-zA-Z]{3}") =>
    3 == str.length  
  }
}

vavr test

Include the following dependency into your project:

testImplementation "com.github.simy4.coregex:coregex-vavr-test"

Use the provided CoregexArbirary class to generate a string that would match the regular expression predicate:

class MyTest {
  @Test
  void myProperty() {
    Property.def("my property")
        .forAll(CoregexArbitrary.of("[a-zA-Z]{3}"))
        .suchThat(str -> 3 == str.length())
        .check();
  }
}

FAQs

Package last updated on 30 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc