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.
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; |
* 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 |
Partitions: | |
1. description: | |
(los especiales) | |
== "Aged Brie" | |
== "French Wine" | |
== "Theatre Passes" | |
el default (Regular) | |
2. sell-in: |
Contexto: | |
producto: Q, sellin, description | |
Invariante: 0 <= Q <= 50 | |
Input (Productos) -> Todos validos | |
Comportamientos: |
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) | |
{ |