Skip to content

Instantly share code, notes, and snippets.

@trikitrok
trikitrok / ProcessOrder.java
Created June 18, 2025 17:36
with notifications coupling is reduced
public class ProcessOrder {
private EventPublisher eventPublisher;
// ... code omitted for brevity
public void execute() {
// business logic to process an order (code omitted for brevity)
// ...
// notification of the event that an order has been processed
@trikitrok
trikitrok / ProcessOrderSuperCoupled.java
Last active June 18, 2025 17:37
without notifications: direct coupling to may collaborators
public class ProcessOrder {
private EmailService emailService;
private InventoryService inventoryService;
private LogisticsService logisticsService;
private AccountingService accountingService;
// ... code omitted for brevity
public void execute() {
// business logic to process an order (code omitted for brevity)
{
"checkers": ["typescript"],
"tsconfigFile": "stryker-tsconfig.json",
"commandRunner": { "command": "export MUTATION_TESTING=true && npm test" }
}
import {GenericDiffReporterBase} from "approvals/lib/Reporting/GenericDiffReporterBase";
import {searchForExecutable} from "approvals/lib/AUtils";
import {Config} from "approvals/lib/config";
class WebStormReporter extends GenericDiffReporterBase {
constructor() {
super("webstorm-reporter");
this.exePath = searchForExecutable("webstorm");
}

Modified Text Processing kata

As a developer that writes blog posts I want a tool that helps me to understand better the text I am writing. For that I need a way to know the following:

  1. What are the most common words used in the text?

  2. How many characters does the text have?

Passing a text through the command line the programa should show the results on the console.

Modified Text Processing kata

As a developer that writes blog posts I want a tool that helps me to understand better the text I am writing. For that I need a way to know the following:

  1. What are the most common words used in the text?

  2. How many characters does the text have?

Passing a text through the command line the programa should show the results on the console.

Next iteration - Extra hot.

The machine has been upgraded and the drink maker is now able to make orange juice and to deliver extra hot drinks. You have to update your code to send the correct messages to the drink maker so that users can have orange juices or extra hot drinks.

Let us see if your implementation is flexible enough to welcome those changes with not too much hassle.

Use cases

Next iteration - Going into business.

The coffee machine is not free anymore! One tea is 0,4 euro, a coffee is 0,6 euro, a chocolate is 0,5 euro.

The drink maker will now only make a drink if enough money is given for it.

Use cases

  • The drink maker should make the drinks only if the correct amount of money is given.
  • If not enough money is provided, we want to send a message to the drink maker. The message should contains at least the amount of money missing.
@trikitrok
trikitrok / ArgentRoseStoreTest.cs
Created May 9, 2025 11:58
Argent Rose super lite tests with 100% coverage but some mutants surviving no Wine
using NUnit.Framework;
namespace ArgentRose.Tests;
public class ArgentRoseStoreTest
{
private const int MIN_QUALITY = 0;
private const int MAX_QUALITY = 50;
private const int SELLIN_LAST_DAY = 0;
private const int EXPIRED = -1;
@trikitrok
trikitrok / ExcludeFilesTest.cs
Created April 4, 2025 09:14
First possible test for legacy-wav-report exercise
public class ExcludeFilesTest
{
[Test]
public void Exclude_File_With_Keyword()
{
var wavExtractor = Substitute.For<WavExtractor32V>();
var excludeFiles = new ExcludeFiles(wavExtractor);
var filenames = new List<string>()
{