Skip to content

Instantly share code, notes, and snippets.

Avatar

Jan Galinski jangalinski

View GitHub Profile
View MatchingCollector.java
package io.github.jangalinski.stream;
import java.util.EnumSet;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BiConsumer;
import java.util.function.BiPredicate;
import java.util.function.BinaryOperator;
View CandidateAssigneDoesNotWorkTest.java
package org.camunda.bpm.extension.mockito;
import org.camunda.bpm.engine.delegate.DelegateTask;
import org.camunda.bpm.engine.delegate.TaskListener;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
View GuiceSingletonProviderTest.java
package com.github.jangalinski;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.junit.Test;
import javax.inject.Provider;
import javax.inject.Singleton;
@jangalinski
jangalinski / BuzzwordClockApplication.java
Created Oct 5, 2015
A super fancy clock for your browser built with Spring Boot, Reactor, Atmosphere, vaadin, Scheduler ....
View BuzzwordClockApplication.java
package io.github.jangalinski.playground.clock;
import com.vaadin.annotations.Push;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
@jangalinski
jangalinski / pom.xml
Created Oct 12, 2014
mixed compile with scala
View pom.xml
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
</dependencies>
<build>
@jangalinski
jangalinski / finalLoggerReplace.java
Created Oct 5, 2014
Replace a static final Logger with a mock
View finalLoggerReplace.java
private Logger replaceLoggerConstantWithMock() throws Exception {
final Field field = DropwizardResourceConfig.class.getDeclaredField("LOGGER");
final Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.setAccessible(true);
field.set(null,mock(Logger.class);
return (Logger) field.get(null);
View _26177485Test.java
package com.github.jangalinski;
import org.assertj.core.api.Assertions;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
View PlaygroundApplication.java
package com.github.jangalinski.deltaspike;
import org.apache.deltaspike.cdise.api.CdiContainer;
import org.apache.deltaspike.cdise.api.CdiContainerLoader;
import org.apache.deltaspike.core.api.provider.BeanProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
View ShouldNotInjectStringTest.java
package org.needle4j.injection;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.needle4j.annotation.InjectIntoMany;
import org.needle4j.annotation.ObjectUnderTest;
import org.needle4j.junit.NeedleBuilders;
import org.needle4j.junit.NeedleRule;
View CustomJobExecutorSpike.java
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import org.camunda.bpm.engine.ManagementService;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.impl.ProcessEngineImpl;
import org.camunda.bpm.engine.impl.context.Context;
import org.camunda.bpm.engine.impl.interceptor.Command;
import org.camunda.bpm.engine.impl.interceptor.CommandContext;
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor;