Skip to content

Instantly share code, notes, and snippets.

@objc func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let userCell = tableView.dequeueReusableCellWithIdentifier("user", forIndexPath: NSIndexPath(forRow: 0, inSection: 0)) as! GithubUserCell;
if let unwrapped = users {
let user = unwrapped[indexPath.row];
userCell.userName.text = user.login;
userCell.imageView?.image = nil;
ImageLoader.load(NSURL(string: user.imageUrl!)!).completionHandler{ (u : NSURL, i : UIImage?, e : NSError?, c : CacheType) -> Void in
package io.ppoborca.anothertestingapplication;
import org.junit.Test;
import org.junit.internal.runners.ClassRoadie;
import org.junit.internal.runners.MethodRoadie;
import org.junit.internal.runners.TestClass;
import org.junit.internal.runners.TestMethod;
import org.junit.runner.Description;
import org.junit.runner.Runner;
import org.junit.runner.notification.Failure;
@Override
public Description getDescription() {
Description spec = Description.createSuiteDescription(getName(), classAnnotations());
List<Method> testMethods = this.testMethods;
for (Method method : testMethods) {
spec.addChild(methodDescription(method));
}
return spec;
}
public class MainActivityPresenterTestOptionOne implements IMainActivity {
private static final String SOME_MOCKED_MESSAGE = "Some Mocked Message";
private Resources resources;
private MainActivityPresenter mainActivityPresenter;
@Before
public void setup(){
resources = Mockito.mock(Resources.class);
Mockito.when(resources.getString(R.string.hello_world)).thenReturn(SOME_MOCKED_MESSAGE);
public class MainActivityPresenterTestOptionTwo implements IMainActivity {
private static final String SOME_MOCKED_MESSAGE = "Some Mocked Message";
private MockedResources resources;
private MainActivityPresenter mainActivityPresenter;
@Before
public void setup(){
resources = new MockedResources();
mainActivityPresenter = new MainActivityPresenter();
public class MockedResources extends Resources{
private Map<Integer, String> stringMap;
public MockedResources(){
this(null, null, null);
}
public MockedResources(AssetManager assets, DisplayMetrics metrics, Configuration config) {
super(assets, metrics, config);
stringMap = new HashMap<>(1);
public class CustomView extends FrameLayout {
public CustomView(Context context) {
super(context, null);
}
public CustomView(Context context, AttributeSet attrs) {
super(context, attrs, 0);
}
var myBinding: MainActivityBinding? = null;
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
myBinding = DataBindingUtil.setContentView<MainActivityBinding>(this, R.layout.ac_main) as MainActivityBinding
///.setContentView(R.layout.ac_main)
val toolbar = myBinding.toolbar;
setSupportActionBar(toolbar)
package i_introduction._0_Hello_World.Hello
import util.TODO
//compiles to a static function in a class HelloPackage
fun main(args: Array<String>) {
println("Hello, world!")
}
fun todoTask0() = TODO(
@PKHandler(container = Bundle.class, handlerImpl = PenKnifeHandlerImpl.class)
public class DemoApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
PenKnife.initialize(new PenKnifeHandlerImpl());
}
}