This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SeleniumFailedCapture implements TestRule { | |
@Override | |
public Statement apply(final Statement base, Description description) { | |
return new Statement() { | |
@Override | |
public void evaluate() throws Throwable { | |
try { | |
base.evaluate(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. 書籍クラスを作り、toJsonメソッドのユニットテストを作成する | |
書籍データ | |
isdn: 477415377X | |
title: JUnit実践入門 | |
author: 渡辺修司 | |
toJson | |
{"isdn":"477415377X","title":"JUnit実践入門","author":"渡辺修司"} | |
2.外部APIを利用し、書籍情報を取得するメソッド(findByIsbn)を作成し、ユニットテストを作成する |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jsonWithCDATA = $('#data').text(); | |
var xml = $.parseXML('<data>' + jsonWithCDATA + '</data>'); | |
var json = $.parseJSON($(xml).find('data').text()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- mvn assembly:assembly --> | |
<!-- http://maven.apache.org/plugins/maven-assembly-plugin/ --> | |
<plugin> | |
<artifactId>maven-assembly-plugin</artifactId> | |
<version>2.4</version> | |
<configuration> | |
<descriptorRefs> | |
<descriptorRef>jar-with-dependencies</descriptorRef> | |
</descriptorRefs> | |
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<properties> | |
<maven.compiler.source>1.7</maven.compiler.source> | |
<maven.compiler.target>1.7</maven.compiler.target> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
</properties> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def from = 10 | |
def to = 20 | |
(from..to).each { println it } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.regex.Matcher | |
"10,12-14,15-".split(',').each { | |
switch(it) { | |
case ~/(\d+)\-(\d+)/: | |
def from = Matcher.lastMatcher[0][1].toInteger() | |
def to = Matcher.lastMatcher[0][2].toInteger() | |
println "from=${from}, to=${to}" | |
break | |
case ~/(\d+)\-/: | |
def from = Matcher.lastMatcher[0][1].toInteger() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
assert [1, 2, 3, 3].unique() == [1, 2, 3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def process = "ls -la".execute() | |
process.waitFor() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo { | |
def foo(String name) { | |
def _ = { | |
"Hello ${name}" | |
} | |
def __ = _.call() | |
return __ | |
} | |
} | |
println new Foo().foo("World") |