Skip to content

Instantly share code, notes, and snippets.

Žan Skamljič zskamljic

  • EqualEyes Solutions Ltd.
Block or report user

Report or block zskamljic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
import org.junit.Before;
import org.junit.Test;
import static junit.framework.TestCase.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
public class MockitoTest {
interface StringProvider {
public void setUp() {
public void tearDown() {
public void testSometing() {
View add
void addLogMethod(CtClass ctClass) {
String body = "System.out.println(\"Added later\");";
CtConstructor[] constructors = ctClass.getConstructors();
if (constructors == null) return;
for (CtConstructor constructor : constructors) {
addCodeIfNeeded(constructor, body);
void addCode(CtConstructor constructor, String body) {
View get
Set<String> getClassNames(Collection<TransformInput> inputs) {
Set<String> classNames = new HashSet<>();
for (TransformInput input : inputs) {
return classNames;
public class CustomTransform extends Transform {
public String getName() {
return "CustomProc";
public Set<QualifiedContent.ContentType> getInputTypes() {
return ImmutableSet.of(QualifiedContent.DefaultContentType.CLASSES);
View registering
void registerTransformer() {
Object android = project.findProperty("android");
if (android instanceof BaseAppModuleExtension) {
System.err.println("Adding transform");
((BaseAppModuleExtension) android).registerTransform(new CustomTransform());
View gist:56292d9812fadd0bc32690cb22bfde24
pluginBundle {
website = ""
vcsUrl = ""
description = "demo plugin"
tags = ["demo", "plugin"]
plugins {
demoPlugin {
id = 'equaleyes.demo'
displayName = 'Demo Plugin'
void addDependencies() {
DependencyHandler dependencies = project.getDependencies();
dependencies.add("implementation", "com.lablizards.depend:depend:1.2.0");
dependencies.add("compileOnly", "com.lablizards.depend:depend-annotations:1.2.0");
dependencies.add("annotationProcessor", "com.lablizards.depend:depend-compiler:1.2.0");
package com.equaleyes.demoplugin;
import org.gradle.api.*;
public class DemoPlugin implements Plugin<Project> {
private static final String TRANSFORM_CLASS = "";
private static final String ERROR_PLUGIN_REQUIRED = "'' or '' plugin required";
private static final String ERROR_PLUGIN_OUTDATED = "Gradle plugin 1.5.0 or later is required.";
You can’t perform that action at this time.