Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Created March 21, 2025 18:44
Show Gist options
  • Save trikitrok/f6b4aa142a5126a6c10a0e6bb6edceae to your computer and use it in GitHub Desktop.
Save trikitrok/f6b4aa142a5126a6c10a0e6bb6edceae to your computer and use it in GitHub Desktop.
export class RSCWorkflow {
private static MAX_LENGTH: number = 200;
//... more code
public validate(packet: Packet): void {
if (packet.getOriginator() === "MIA"
|| packet.getLength() > RSCWorkflow.MAX_LENGTH
|| !packet.hasValidCheckSum()) {
throw new InvalidFlowException();
}
//... more code that does not use any instance data or methods
}
//... more code
}
//////////////////////////////////////////////
export class RSCWorkflow {
private static MAX_LENGTH: number = 200;
//... more code
//!! we made it static for testing :(
public static validate(packet: Packet): void {
if (packet.getOriginator() === "MIA"
|| packet.getLength() > RSCWorkflow.MAX_LENGTH
|| !packet.hasValidCheckSum()) {
throw new InvalidFlowException();
}
//... more code that does not use instance data or methods
}
//... more code
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment