Skip to content

Instantly share code, notes, and snippets.

View mariorez's full-sized avatar

Mario Rezende mariorez

View GitHub Profile
@mariorez
mariorez / main.kt
Created May 27, 2022 03:37 — forked from RezMike/main.kt
Code for "KorGE Tutorial - Writing 2048 game. Step 1 - Views"
import com.soywiz.korge.*
import com.soywiz.korge.html.*
import com.soywiz.korge.view.*
import com.soywiz.korim.color.*
import com.soywiz.korim.font.*
import com.soywiz.korim.format.*
import com.soywiz.korio.file.std.*
import com.soywiz.korma.geom.*
import com.soywiz.korma.geom.vector.*
@mariorez
mariorez / java-11-essential-modules.txt
Last active October 7, 2021 20:49
JAVA 11 ESSENTIAL MODULES
java.base
java.compiler
java.datatransfer
java.instrument
java.logging
java.management
java.management.rmi
java.naming
java.net.http
java.prefs
@mariorez
mariorez / java-11-full-modules.txt
Last active October 7, 2021 20:44
JAVA 11 FULL MODULES
java.base
java.compiler
java.datatransfer
java.desktop
java.instrument
java.logging
java.management
java.management.rmi
java.naming
java.net.http
subscriber.receive(_) >> { throw new InternalError("ouch") }
given:
def stack = new Stack()
when:
stack.pop()
then:
thrown(EmptyStackException)
stack.empty
subscriber.receive(_) >> "ok"
| | | |
| | | gerador de resposta
| | argumento de restrição
| método de restrição
objeto de restrição
class Publisher {
private Subscriber subscriber
Publisher(Subscriber subscriber) {
this.subscriber = subscriber
}
String sendAndGetStatus(String message) {
return subscriber.receive(message)
}
1 * subscriber1.receive("hello")
| | | |
| | | restrição de argumento
| | restrição de método
| restrição de alvo
restrição por cardinalidade
class Publisher {
List<Subscriber> subscribers = []
void send(String message){
subscribers*.receive(message)
}
}
interface Subscriber {
void receive(String message)
}
Subscriber subscriber1 = Mock()
Subscriber subscriber2 = Mock()