{"id":20206272,"url":"https://github.com/c0stra/fluent-api-dry-run","last_synced_at":"2026-07-18T00:34:46.778Z","repository":{"id":57731323,"uuid":"362525762","full_name":"c0stra/fluent-api-dry-run","owner":"c0stra","description":"Reflection proxy based dry run of complex fluent sentences (statements)","archived":false,"fork":false,"pushed_at":"2021-05-25T15:59:33.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-20T10:41:35.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/c0stra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-28T15:50:56.000Z","updated_at":"2021-05-25T15:59:36.000Z","dependencies_parsed_at":"2022-09-26T22:10:21.292Z","dependency_job_id":null,"html_url":"https://github.com/c0stra/fluent-api-dry-run","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/c0stra/fluent-api-dry-run","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c0stra%2Ffluent-api-dry-run","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c0stra%2Ffluent-api-dry-run/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c0stra%2Ffluent-api-dry-run/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c0stra%2Ffluent-api-dry-run/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/c0stra","download_url":"https://codeload.github.com/c0stra/fluent-api-dry-run/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c0stra%2Ffluent-api-dry-run/sbom","scorecard":{"id":260925,"data":{"date":"2025-08-11","repo":{"name":"github.com/c0stra/fluent-api-dry-run","commit":"2e45582079981d30f4dc563ff5253257d31c018d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/23 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 2-Clause \"Simplified\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T10:49:24.326Z","repository_id":57731323,"created_at":"2025-08-17T10:49:24.327Z","updated_at":"2025-08-17T10:49:24.327Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35600606,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-17T02:00:06.162Z","response_time":116,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T05:22:39.011Z","updated_at":"2026-07-18T00:34:46.757Z","avatar_url":"https://github.com/c0stra.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fluent API dry run\n[![Released version](https://img.shields.io/maven-central/v/foundation.fluent.api/fluent-api-dry-run.svg)](https://search.maven.org/#search%7Cga%7C1%7Cfluent-api-dry-run)\n[![Build Status](https://travis-ci.org/c0stra/fluent-api-dry-run.svg?branch=master)](https://travis-ci.org/c0stra/fluent-api-dry-run)\n\nReflection proxy based dry run of complex fluent sentences (statements).\n\nIt's not really about mocking in terms of testing, but rather allowing to\nbypass the real functionality normally provided by existing implementations.\n\nCompared to normal situations, where providing some simple alternative implementation\nis about one/two classes, with fluent API this task gets much more complex.\n\nThe problem is, that any method, at the end returning `null` introduces a risk\nof `NullPointerException` further in the fluent method chain. So with fluent API, we need to avoid\nreturning `null` even in cases, when we want to \"bypass\" the implementation.\n\nImagine following code:\n```java\nuser.opens(\"http://test-application/\")\n        .enters().login(\"user123\").password(\"s3cr3t\")\n        .andSubmits();\n```\n\nWhen e.g. we just provide simple bypassing implementation (or mock like mockito) of the `user`,\nwhere method `opens()` returns null, we get `NullPointerException` when method `enters()` should be invoked.\n\nTherefore a solution provided in this module, is reflection proxy based, automatically propagating\nmechanism, which is avoiding this risk.\n\n### 1. Maven configuration\nIn order to have this feature available, you need to add following maven dependency:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003efoundation.fluent.api\u003c/groupId\u003e\n    \u003cartifactId\u003efluent-api-dry-run\u003c/artifactId\u003e\n    \u003cversion\u003e1.2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### 2. Usage\nYou get the dry run \"implementation\" of some fluent API root by following initialization:\n```java\nUser user = DryRun.create(\"My dry run\", User.class);\n```\nIn turn you can use the fluent api of `User` and it won't throw any `NullPointerException`:\n```java\nuser.opens(\"http://test-application/\")\n        .enters().login(\"user123\").password(\"s3cr3t\")\n        .andSubmits();\n```\n\n### 3. Default instances\nThis tool can only propagate itself on interfaces. But it provides simple workaround for non-interface return types.\nYou can provide set of default values. If a any default value can be assigned to current return type, it will be returned.\nOnly if none matches, then for proxy the propagation will take place, and for non-proxy an exception is thrown, so the\npoint of failure is clear, avoiding `NPE` somewhere in complex chain, where it's impossible to find\nout for which method it got thrown.\n\nSo in fact even interface return types can be instructed to return default value instead of performing\nthe auto-propagation.\n\nThere is implicit set of default values, which is always present for primitive types.\nAdditional ones can be provided by additional vararg parameters of the `dryRun` method.\n\n### 4. Method invocation callback\nThe implementation allows to subscribe for individual method calls using a callback.\nYou can provide additional parameter `MethodCallEventHandler` function interface, and this one will receive\nall method calls in the chain.\n\n### 5. Reflection and generics\nNormally generics are referred as compile time only feature in Java. It's not completely\ntrue. The reflection API contains options to get also generic information about types in some\nsituations.\n\nE.g.\n```java\nprivate final List\u003cT\u003e list;\n```\nIn the code above, the generic information is not available. The `T` is just a parameter.\n\nBut in this case:\n```java\nprivate final List\u003cString\u003e list;\n```\neven the Java reflection allows us to get the information. In that case\nthe `Field.getGenericType()` method returns `ParametrizedType` representation, which contains\nactual type parameters.\n\nHaving said that, we can overcome the standard limitations of runtime type erasure, and still\nget / resolve actual type parameters in generic types, under some circumstances.\n\nThe current limitation simply is, that the interface representing our entry point in the fluent API\n(the class, provided to the factory, e.g. `User.class`) needs not to take any generic parameters.\nBut any inherited interfaces can.\n\nSecond limitation is of course on generic methods. Those cannot be resolved.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc0stra%2Ffluent-api-dry-run","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fc0stra%2Ffluent-api-dry-run","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc0stra%2Ffluent-api-dry-run/lists"}