@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private NestedObject nestedObject;
example usage in a test method:
when(nestedObject.getStatusInfo().getValue().getStatus()).thenReturn(1);
#!/bin/bash | |
# USAGE: run-kibana.sh http://localhost:9200 | |
echo "Running kibana for es host:$1" | |
docker run --name kibana -d -p 5601:5601 \ | |
-e ELASTICSEARCH_HOSTS=$1 \ | |
-e XPACK_GRAPH_ENABLED=false \ | |
-e XPACK_ML_ENABLED=false \ |
BEGIN; | |
LOCK TABLE ... IN SHARE MODE; | |
SET LOCAL WORK_MEM = '256MB'; | |
ALTER TABLE ...; | |
COMMIT; |
public final class TurkishNumberUtils { | |
private static final String SPACE = " "; | |
private static final String EMPTY = ""; | |
private static final String[] PERIOD_NAMES = {EMPTY, "bin", "milyon", "milyar", "trilyon", "katrilyon", "kentilyon"}; | |
private static final String[] UNITS_TEXTS = {EMPTY, "bir", "iki", "üç", "dört", "beş", "altı", "yedi", "sekiz", "dokuz"}; |
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private NestedObject nestedObject;
example usage in a test method:
when(nestedObject.getStatusInfo().getValue().getStatus()).thenReturn(1);
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.mockito.Mockito; | |
import org.powermock.api.mockito.PowerMockito; | |
import org.powermock.core.classloader.annotations.PrepareForTest; | |
import org.powermock.modules.junit4.PowerMockRunner; | |
@RunWith(PowerMockRunner.class) | |
@PrepareForTest(MyFinalClass.class) | |
public class MyFinalClassTest { |
/* | |
* | |
* Methods manipulate milliseconds field (fastTime) in java.util.Date object. | |
* | |
* UTC : 12/10/2017 11:15:00 | |
* Local date time : 12/10/2017 14:15:00 +03:00 | |
* | |
* @return new java.util.Date | |
* UTC : 12/10/2017 14:15:00 | |
* Local date time : 12/10/2017 17:15:00 +03:00 |
/** | |
* | |
* ----------------------------------------------------------------------------------- | |
* From : org.junit.rules.DisableOnDebug#isDebugging(java.util.List<java.lang.String>) | |
* ----------------------------------------------------------------------------------- | |
* | |
* Parses arguments passed to the runtime environment for debug flags | |
* <p> | |
* Options specified in: | |
* <ul> |
public class ComparingUtils { | |
public static <T extends Comparable<T>> ComparisonBuilder<T> is(T comparable) { | |
return new ComparisonBuilder<>(comparable); | |
} | |
public static class ComparisonBuilder<T> { | |
private Comparable<T> subject; |
import lombok.AllArgsConstructor; | |
import lombok.Data; | |
@Data | |
@AllArgsConstructor | |
public class LazyDeveloper { | |
private String firstName; | |
private String lastName; |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.