Skip to content

Instantly share code, notes, and snippets.

Felipe Mamud fmamud

  • Berlin, Germany
Block or report user

Report or block fmamud

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fmamud
fmamud / gradle.build.kts
Last active Nov 29, 2018
FatJar with Gradle Kotlin DSL
View gradle.build.kts
plugins {
// Apply the Kotlin JVM plugin to add support for Kotlin on the JVM
kotlin("jvm").version("1.3.10")
application
}
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
@fmamud
fmamud / ratpack.groovy
Created Dec 2, 2016
Ratpack simple example that serves first json file found in current directory
View ratpack.groovy
@Grab('io.ratpack:ratpack-groovy:1.4.4')
import static ratpack.groovy.Groovy.ratpack
import static ratpack.jackson.Jackson.json
import groovy.json.JsonSlurper
def parser = new JsonSlurper()
ratpack {
handlers {
@fmamud
fmamud / MySpec.groovy
Last active Oct 27, 2016
Mock and Spy in Spock Specification
View MySpec.groovy
import spock.lang.*
class MySpec extends Specification {
def starshipName = 'NCC-1701'
def "size method should be executed three times"() {
given:
List list = Mock()
when:
@fmamud
fmamud / pom.xml
Created Oct 14, 2016
Spock in Maven
View pom.xml
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.0-groovy-2.4</version>
</dependency>
@fmamud
fmamud / build.gradle
Last active Oct 14, 2016
Spock in Gradle
View build.gradle
dependencies {
testCompile group: 'org.spockframework', name: 'spock-core', version: '1.0-groovy-2.4'
}
@fmamud
fmamud / MySpec.groovy
Created Oct 14, 2016
Stubbing multiple parameters in Spock Specification
View MySpec.groovy
import spock.lang.*
class MySpec extends Specification {
def "should return 2 for method parameter equal to 2"() {
given:
List list = Stub()
list.get(0) >> 0
list.get(1) >> { throw new IllegalArgumentException() }
list.get(2) >> 2
@fmamud
fmamud / MySpec.groovy
Created Oct 14, 2016
Stubbing many returns in Spock Specification
View MySpec.groovy
import spock.lang.*
class MySpec extends Specification {
def "should return 1,2,3 respectively when calling size list"() {
given:
List list = Stub()
list.size() >>> [1,2,3]
expect:
@fmamud
fmamud / MySpec.groovy
Created Oct 14, 2016
Stubbing Spock Specification
View MySpec.groovy
import spock.lang.*
class MySpec extends Specification {
def "should size list return always 3"() {
given:
List list = Stub()
list.size() >> 3
expect:
@fmamud
fmamud / MySpec.groovy
Created Oct 14, 2016
Data Table in Spock Specification
View MySpec.groovy
import spock.lang.*
class MySpec extends Specification {
def "maximum of two numbers"(int a, int b, int c) {
expect:
Math.max(a, b) == c
where:
a | b | c
@fmamud
fmamud / MySpec.groovy
Created Oct 14, 2016
Expect and Setup sections in Spock Specification
View MySpec.groovy
import spock.lang.*
class MySpec extends Specification {
def "should return 4 after list sum"() {
setup:
def list = [2, 2]
expect:
4 == list.sum()
You can’t perform that action at this time.