Skip to content

Instantly share code, notes, and snippets.

@trikitrok
trikitrok / CourseTest.java
Created September 14, 2024 11:24
course-duration tests in Java
package unit_tests;
import course_duration.Clock;
import course_duration.Configuration;
import course_duration.Course;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
@trikitrok
trikitrok / identifying_boundaries_argent_rose_lite.txt
Created September 13, 2024 11:55
Argent Rose Lite identifying boundaries
* sell-in (int):
Partitions
P1: sell-in € (-inf,0)
P2: sell-in € (5, inf) (Theatre)
P4: sell-in € [0, 5] (Theatre)
Boundaries
B1: sell-in en 0 entre P1 y P4 => on point= 0 en P4, off point=-1 P1
@trikitrok
trikitrok / identifying_partitions_argent_rose_lite.txt
Last active September 13, 2024 12:51
Argent Rose Lite identifying partitions
Partitions:
1. description:
(los especiales)
== "Aged Brie"
== "French Wine"
== "Theatre Passes"
el default (Regular)
2. sell-in:
@trikitrok
trikitrok / understanding_problem_argent_rose_lite.txt
Last active September 13, 2024 13:31
Argent Rose Lite identifying behaviors
Contexto:
producto: Q, sellin, description
Invariante: 0 <= Q <= 50
Input (Productos) -> Todos validos
Comportamientos:
@trikitrok
trikitrok / greenfield-argent-rose-lite.md
Last active September 9, 2024 18:25
Argent Rose Requirements Specification lite version

Argent Rose Requirements Specification

Context.

My name is Syl. I'm the owner of the Argent Rose, a small wizardry store.

I need to update the inventory of my store, at the end of each day, in order to track the quality and sell-in of my products.

@trikitrok
trikitrok / DoublesWithMockito.md
Last active September 7, 2024 13:42
Use of test doubles with Mockito

Tools

Mockito

Example of spy

interface CourseChat {
    void send(String message);
}
// Step 4
class GDIBrush implements PointRenderer {
private int colorId;
public void draw(List<Point> renderingRoots,
ColorMatrix colors,
List<Point> selection) {
Renderer renderer = new Renderer(this, renderingRoots, colors, selection);
renderer.draw(); // !!! -> we call the method object
}
// Step 3
// !!! -> extracted interface with the things the
// object method uses from the original class
interface PointRenderer {
int getColorId();
void drawPoint(int x, int y, Color color);
}
// Step 2
class Renderer {
private final GDIBrush brush;
private final List<Point> renderingRoots;
private final ColorMatrix colors;
private final List<Point> selection;
public Renderer(GDIBrush brush, List<Point> renderingRoots, ColorMatrix colors, List<Point> selection) {
this.brush = brush;
// Step 1
class GDIBrush
{
private int colorId;
// A long method
public void draw(List<Point> renderingRoots,
ColorMatrix colors,
List<Point> selection)
{