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
HugeIface mock = mock(HugeIface.class); | |
doReturn(5).when(mock).fooBar(); |
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
@Test | |
public void bar() { | |
Geometry mock = mock(Geometry.class); | |
doReturn(12.3).when(mock).tan(pi/2); | |
} | |
interface Geometry { | |
/** | |
* Must return null when x = pi/2 |
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
@Test | |
public void bar() { | |
ITest mock = mock(ITest.class); | |
doReturn(new BigDecimal(5)).when(mock).foo(1); | |
mock.foo(1L); | |
} | |
interface ITest { |
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
interface Entity { | |
Collection data(); | |
} | |
interface TraversableEntity { | |
Entity asEntity(); // this | |
TraversableEntity traverseTo(Property prop); | |
} |
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
interface Entity { | |
Collection data(); | |
} | |
interface TraversableEntity extends Entity { | |
TraversableEntity traverseTo(Property prop); | |
} | |
interface SingleRecord extends TraversableEntity { | |
Identifier id(); |
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 com.netflix.config.ConfigurationManager; | |
import com.netflix.hystrix.HystrixCommand; | |
import com.netflix.hystrix.HystrixCommandGroupKey; | |
import com.netflix.hystrix.HystrixCommandKey; | |
import com.netflix.hystrix.HystrixCommandProperties; | |
import org.apache.commons.io.IOUtils; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.client.HttpClient; | |
import org.apache.http.client.methods.HttpGet; | |
import org.apache.http.impl.client.HttpClientBuilder; |
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
protected Collection<Order> getOrders(List<Message> messages, Map<String, Message> messagesMap, List<Message> messagesToInhibitStorage, | |
Map<Message, String> messagesToReprocessStorage, Map<String, DateTime> statusDates) | |
throws JsonParseException, JsonMappingException, UnsupportedEncodingException, IOException { |
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
for (...) { | |
if (...) { | |
try { | |
try { | |
if (...) { | |
if (...) { | |
for (...) { | |
if (...) { | |
} else if (...) { | |
} |
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 static <T> Observable<T> takeWhileInclusive(Observable<T> source, Func1<T, Boolean> predicate) { | |
return source | |
.publish(selector -> | |
selector.takeWhile(predicate).concatWith(source.skipWhile(predicate).take(1))); | |
} |
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
CREATE OR REPLACE PROCEDURE load_expression (dir NVARCHAR2, filename NVARCHAR2, id number) AS | |
dest_clob CLOB; | |
src_clob BFILE ; | |
dst_offset number := 1 ; | |
src_offset number := 1 ; | |
lang_ctx number := DBMS_LOB.DEFAULT_LANG_CTX; | |
warning number; | |
stmt VARCHAR2(500):= 'CREATE OR REPLACE DIRECTORY MY_DIR AS ' || '''' ||dir|| ''''; | |
BEGIN | |
DBMS_OUTPUT.ENABLE(100000); |