You can post a json file with curl
like so:
curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION
so for example:
/** | |
* Replaces the default RxJava schedulers with a synchronous one. | |
*/ | |
class RxImmediateSchedulerRule : TestRule { | |
private val immediateScheduler = object : Scheduler() { | |
@NonNull | |
override fun scheduleDirect(@NonNull run: Runnable, delay: Long, @NonNull unit: TimeUnit): Disposable { | |
// Hack to prevent stack overflows in unit tests when scheduling with a delay; | |
return super.scheduleDirect(run, 0, unit) | |
} |
private fun <T> mutableLazy(initializer: () -> T) = Delegate(lazy(initializer)) | |
class Delegate<T>(private val lazy: Lazy<T>) { | |
private var value: T? = null | |
operator fun getValue(thisRef: Any?, property: KProperty<*>): T { | |
return value ?: lazy.getValue(thisRef, property) | |
} | |
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T) { |
// Usage - MainActivity | |
val collapsible = myCardView.buildCollapsible() | |
myButton.onClick { | |
collapsible.toggle() | |
} | |
// ============================================================================================================================ | |
package your_package | |
import android.animation.ValueAnimator | |
import android.support.v7.widget.CardView |
/* | |
* Copyright(c) 2012 Android Test and Evaluation Club. | |
* | |
*/ | |
package org.android_tec.atmarkit.usemockexample.models; | |
import static org.mockito.Mockito.inOrder; | |
import static org.mockito.Mockito.mock; | |
import static org.mockito.Mockito.when; |
class App : Application(), HasActivityInjector { | |
@Inject lateinit var activityInjector: DispatchingAndroidInjector<Activity> | |
override fun activityInjector(): AndroidInjector<Activity> { | |
return activityInjector | |
} | |
override fun onCreate() { | |
super.onCreate() |
@file:Suppress("unused", "FunctionName", "IllegalIdentifier") | |
import android.annotation.SuppressLint | |
import android.app.Activity | |
import android.content.Context | |
import android.content.Intent | |
import android.os.Bundle | |
/** | |
* The best way to launch yourself an activity. Your implementation should enable the following api: |
/** | |
* ArcUtils.java | |
* | |
* Copyright (c) 2014 BioWink GmbH. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |