package com.ankurm.reviewbot; import java.util.ArrayList; import java.util.List; final class Fixtures { private Fixtures() {} /** A small PR: one Java file with two hunks, one lockfile, and a context line at new line 1. */ static final String DIFF = """ diff --git a/src/Login.java b/src/Login.java index 111..222 100644 --- a/src/Login.java +++ b/src/Login.java @@ -1,4 +1,7 @@ class Login { + String password = "hunter2"; + // TODO move to vault void run() { + System.out.println("login"); } } diff --git a/package-lock.json b/package-lock.json index 333..444 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,2 +1,3 @@ { + "lockfileVersion": 3, } """; /** The webhook body Gitea sends for pull_request_sync, trimmed to the fields the bot reads. */ static final String PAYLOAD = """ {"action":"synchronized","repository":{"full_name":"asmhatre/demo"}, "pull_request":{"number":7,"head":{"sha":"abc123"}}}"""; /** A synthetic diff with {@code files} files of one added line each, for the budget test. */ static String manyFiles(int files) { List parts = new ArrayList<>(); for (int i = 1; i <= files; i++) { parts.add("diff --git a/F" + i + ".java b/F" + i + ".java\n--- a/F" + i + ".java\n+++ b/F" + i + ".java\n@@ -0,0 +1,1 @@\n+System.out.println(" + i + ");"); } return String.join("\n", parts) + "\n"; } }