This file contains hidden or 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
@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 |
This file contains hidden or 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
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; |
This file contains hidden or 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
@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; | |
} |
This file contains hidden or 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 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); |
This file contains hidden or 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 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(); |
This file contains hidden or 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 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); |
This file contains hidden or 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 CustomView extends FrameLayout { | |
public CustomView(Context context) { | |
super(context, null); | |
} | |
public CustomView(Context context, AttributeSet attrs) { | |
super(context, attrs, 0); | |
} |
This file contains hidden or 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
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) |
This file contains hidden or 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
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( |
This file contains hidden or 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
@PKHandler(container = Bundle.class, handlerImpl = PenKnifeHandlerImpl.class) | |
public class DemoApplication extends Application { | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
PenKnife.initialize(new PenKnifeHandlerImpl()); | |
} | |
} |