Exemplo
org.robolectric/robolectric 4.13: org.robolectric.junit.rules.BackgroundTestRule
Amostra verificada para maven org.robolectric/robolectric 4.13: org.robolectric.junit.rules.BackgroundTestRule. O contrato rodou em java 21 · linux 2023/x64…
sha256:2f105e289aa0b12f19d289a6d8e67497ca494b0cd312eca193ce0829f7915021
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 5
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
java 21 linux 24 · ubuntu · glibc 2.39 x64 java 21 java gradle 8
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| java 21 · linux 2023/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:PASS · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · gradle-java@1gradle:8.14.3-jdk21-corretto-al2023@sha256:05cb2f8b4a77… |
2026-09-09 |
| java 8 · linux 2023/x64 · docker ed25519:c1973797be207ac4 | FAIL | compile:PASS · contract:FAIL · load:SKIPPED · resolve:PASS CONTAINER_RUN · gradle-java@1gradle:8.14.3-jdk8-corretto-al2023@sha256:ec6379bf6453… |
2026-09-09 |
| java 11 · linux 2023/x64 · docker ed25519:c1973797be207ac4 | SKIPPED | compile:SKIPPED · contract:SKIPPED · load:SKIPPED · resolve:FAIL CONTAINER_RUN · gradle-java@1gradle:8.14.3-jdk11-corretto-al2023@sha256:93d9f84a044f… |
2026-09-09 |
| java 17 · linux 2023/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:PASS · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · gradle-java@1gradle:8.14.3-jdk17-corretto-al2023@sha256:9a40f91169b9… |
2026-09-09 |
| java 25 · linux 2023/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:PASS · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · gradle-java@1gradle:9.7.0-jdk25-corretto-al2023@sha256:bb35f0164972… |
2026-09-09 |
Caso
HOW- Objetivo
- verify org.robolectric.junit.rules.BackgroundTestRule in pkg:maven/org.robolectric/robolectric@4.13
- Pacotes
- Símbolos
-
- org.robolectric.junit.rules.BackgroundTestRule
- Ambiente
- java 21
- Criado
- 2026-09-09T05:57:00Z
Contrato
- org.robolectric.junit.rules.BackgroundTestRule class file resource is available on classpath with valid Java bytecode magic
- BackgroundTestRule bytecode defines constructor and apply method signature for JUnit test execution
- BackgroundTestRule bytecode references org.junit.rules.TestRule interface
- BackgroundTestRule inner annotation BackgroundTest class file resource is available on classpath with valid Java bytecode magic
Arquivos
- PROMPT.md
- csx.json
- spec.json
- src/main/java/sample/Sample.java
- test/Contract.java
Código-fonte
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify org.robolectric.junit.rules.BackgroundTestRule in pkg:maven/org.robolectric/robolectric@4.13
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:maven/org.robolectric/robolectric@4.13
Demonstrate these symbols/APIs:
- org.robolectric.junit.rules.BackgroundTestRule
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"buildCommand":["gradle","--offline","--no-daemon","--no-scan","--console=plain","--project-dir","/work/.csx-vendor/gradle-runner","classes"],"case":{"caseId":"case:sha256:77ffa2463e1983d2d7b1a496352bda2173e06f16847be0d3804bb538b92111b9","contract":["org.robolectric.junit.rules.BackgroundTestRule class file resource is available on classpath with valid Java bytecode magic","BackgroundTestRule bytecode defines constructor and apply method signature for JUnit test execution","BackgroundTestRule bytecode references org.junit.rules.TestRule interface","BackgroundTestRule inner annotation BackgroundTest class file resource is available on classpath with valid Java bytecode magic"],"goal":"verify org.robolectric.junit.rules.BackgroundTestRule in pkg:maven/org.robolectric/robolectric@4.13","kind":"HOW","packages":["pkg:maven/org.robolectric/robolectric@4.13"],"schemaVersion":1,"symbols":["org.robolectric.junit.rules.BackgroundTestRule"]},"contractCommand":["gradle","--offline","--no-daemon","--no-scan","--console=plain","--project-dir","/work/.csx-vendor/gradle-runner","contract"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"maven","language":"java","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"gradle","packageManagerVersion":"8.14.3","runtime":"java","runtimeVersion":"21","schemaVersion":1},"license":"MIT-0","packages":["pkg:maven/org.robolectric/robolectric@4.13"],"schemaVersion":1,"subject":"pkg:maven/org.robolectric/robolectric@4.13","symbols":["org.robolectric.junit.rules.BackgroundTestRule"],"verifierAdapter":"gradle-java@1"}
{
"schemaVersion": 1,
"goal": "verify org.robolectric.junit.rules.BackgroundTestRule in pkg:maven/org.robolectric/robolectric@4.13",
"kind": "HOW",
"packages": [
"pkg:maven/org.robolectric/robolectric@4.13"
],
"symbols": [
"org.robolectric.junit.rules.BackgroundTestRule"
]
}
package sample;
public class Sample {
public static String getSymbol() {
return "org.robolectric.junit.rules.BackgroundTestRule";
}
public static String getPackage() {
return "pkg:maven/org.robolectric/robolectric@4.13";
}
}
import sample.Sample;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
public class Contract {
private static byte[] readResource(ClassLoader loader, String path) throws Exception {
try (InputStream in = loader.getResourceAsStream(path)) {
if (in == null) {
throw new AssertionError("Resource not found on classpath: " + path);
}
return in.readAllBytes();
}
}
private static List<String> parseUtf8Constants(byte[] classBytes) throws Exception {
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(classBytes));
int magic = dis.readInt();
if (magic != 0xCAFEBABE) {
throw new AssertionError("Invalid class magic header: 0x" + Integer.toHexString(magic));
}
int minor = dis.readUnsignedShort();
int major = dis.readUnsignedShort();
if (major < 49) {
throw new AssertionError("Unexpected JVM major version: " + major);
}
int cpCount = dis.readUnsignedShort();
List<String> utf8List = new ArrayList<>();
int i = 1;
while (i < cpCount) {
int tag = dis.readUnsignedByte();
switch (tag) {
case 1: // Utf8
String str = dis.readUTF();
utf8List.add(str);
break;
case 3: // Integer
case 4: // Float
dis.skipBytes(4);
break;
case 5: // Long
case 6: // Double
dis.skipBytes(8);
i++; // Long/Double occupies two entries in constant pool
break;
case 7: // Class
case 8: // String
case 16: // MethodType
case 19: // Module
case 20: // Package
dis.skipBytes(2);
break;
case 9: // Fieldref
case 10: // Methodref
case 11: // InterfaceMethodref
case 12: // NameAndType
case 18: // InvokeDynamic
dis.skipBytes(4);
break;
case 15: // MethodHandle
dis.skipBytes(3);
break;
default:
throw new AssertionError("Unknown constant pool tag: " + tag);
}
i++;
}
return utf8List;
}
public static void main(String[] args) {
try {
// 0. Verify sample helper
if (!"org.robolectric.junit.rules.BackgroundTestRule".equals(Sample.getSymbol())) {
throw new AssertionError("Sample symbol mismatch: " + Sample.getSymbol());
}
if (!"pkg:maven/org.robolectric/robolectric@4.13".equals(Sample.getPackage())) {
throw new AssertionError("Sample package mismatch: " + Sample.getPackage());
}
ClassLoader loader = Contract.class.getClassLoader();
// 1. Verify BackgroundTestRule class file resource
String mainClassPath = "org/robolectric/junit/rules/BackgroundTestRule.class";
byte[] mainBytes = readResource(loader, mainClassPath);
List<String> mainUtf8 = parseUtf8Constants(mainBytes);
// 2. Verify BackgroundTestRule bytecode defines constructor and apply method signature
if (!mainUtf8.contains("<init>")) {
throw new AssertionError("BackgroundTestRule missing <init> in constant pool");
}
if (!mainUtf8.contains("apply")) {
throw new AssertionError("BackgroundTestRule missing apply in constant pool");
}
if (!mainUtf8.contains("(Lorg/junit/runners/model/Statement;Lorg/junit/runner/Description;)Lorg/junit/runners/model/Statement;")) {
throw new AssertionError("BackgroundTestRule missing apply descriptor in constant pool");
}
// 3. Verify BackgroundTestRule bytecode references org.junit.rules.TestRule interface
if (!mainUtf8.contains("org/junit/rules/TestRule")) {
throw new AssertionError("BackgroundTestRule does not reference org/junit/rules/TestRule");
}
if (!mainUtf8.contains("org/robolectric/junit/rules/BackgroundTestRule")) {
throw new AssertionError("BackgroundTestRule does not contain its own class name");
}
// 4. Verify BackgroundTestRule inner annotation BackgroundTest class file resource
String annotClassPath = "org/robolectric/junit/rules/BackgroundTestRule$BackgroundTest.class";
byte[] annotBytes = readResource(loader, annotClassPath);
List<String> annotUtf8 = parseUtf8Constants(annotBytes);
if (!annotUtf8.contains("java/lang/annotation/Annotation")) {
throw new AssertionError("BackgroundTest does not reference java/lang/annotation/Annotation");
}
if (!annotUtf8.contains("org/robolectric/junit/rules/BackgroundTestRule$BackgroundTest")) {
throw new AssertionError("BackgroundTest does not contain its own class name");
}
System.out.println("Contract PASS: org.robolectric.junit.rules.BackgroundTestRule contract verified successfully.");
} catch (Throwable t) {
t.printStackTrace();
System.exit(1);
}
}
}
Seeder de origem
anônimo