/* Block comment */
import java.util.Date;
/**
* Doc comment here for <code>SomeClass</code>
* @see Math#sin(double)
*/
@Annotation (name=value)
public class SomeClass<T extends Runnable> { // some comment
private T field = null;
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 android.content.Context; | |
import android.util.AttributeSet; | |
import android.widget.AbsListView; | |
import se.emilsjolander.stickylistheaders.StickyListHeadersListView; | |
public class RequestMoreListView extends StickyListHeadersListView implements AbsListView.OnScrollListener { | |
private OnRequestMoreListener mOnRequestMoreListener; | |
private boolean mIsRequesting; |
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 ParcelableModelTest extends TestCase { | |
public void testShouldParcelProperly() { | |
/* Prepare data */ | |
ParcelableModel expectedModel = new ParcelableModel(); | |
expectedModel.setProperty0(123); | |
expectedModel.setProperty1("LOL"); | |
/* Perform parcelling */ |
- Tại sao nói "On the other hand, black box tests can bring more value than white box tests."? Có những ví dụ cụ thể nào để chứng minh điều này?
- Tại sao mình phải measure test coverage?
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.google.android.gms.maps.model.UrlTileProvider; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
public class MapBoxTileProvider extends UrlTileProvider { | |
private String mBaseTileUrl; | |
private String mMapId; | |
private String mAccessToken; |
Observable.from(Arrays.array(1, 2, 3, 4, 5))
.groupBy(new Func1<Integer, Boolean>() {
@Override
public Boolean call(Integer number) {
return number % 2 == 0;
}
})
.flatMap(new Func1<GroupedObservable<Boolean, Integer>, GroupedObservable<Boolean, Integer>>() {
@Override
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 android.os.Handler; | |
import android.os.Looper; | |
import com.squareup.otto.Bus; | |
import com.squareup.otto.ThreadEnforcer; | |
/** | |
* A custom {@link Bus} that posts events from any thread and | |
* lets subscribers receive them on the main thread. | |
*/ |
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 DbField { | |
public final String name; | |
public final String type; | |
public final String constraint; | |
public DbField(String name, String type) { | |
this(name, type, null); | |
} | |
public DbField(String name, String type, String constraint) { |
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 GistFetcherTest extends InstrumentationTestCase { | |
public void testFetch() throws IOException { | |
final InputStream mockResponseStream = getInstrumentation().getContext().getAssets().open("mock_response.json"); | |
OkHttpClient httpClient = new OkHttpClient(); | |
httpClient.interceptors().add(new Interceptor() { | |
@Override | |
public Response intercept(Chain chain) throws IOException { | |
return new Response.Builder() | |
.protocol(Protocol.HTTP_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
import android.content.Context; | |
import android.test.InstrumentationTestCase; | |
import com.google.gson.Gson; | |
import com.google.gson.reflect.TypeToken; | |
import com.google.gson.stream.JsonReader; | |
import java.io.BufferedInputStream; | |
import java.io.BufferedOutputStream; | |
import java.io.File; |
OlderNewer