Skip to content

Instantly share code, notes, and snippets.

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.NoSuchElementException;
import java.util.Stack;
/**
* Решение задачи собеседования: сделать очередь из двух стеков
public static void main(String[] args) throws JMSException, IOException {
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://locserv:61616");
cf.setUserName("admin");
cf.setPassword("admin");
Connection connection = cf.createConnection();
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@Bean
public WebMvcConfigurerAdapter webMvcConfigurerAdapter() {
return new WebMvcConfigurerAdapter() {
@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
super.configureMessageConverters(converters);
converters.stream()
.filter(converter -> converter instanceof MappingJackson2HttpMessageConverter)
.map(converter -> (MappingJackson2HttpMessageConverter) converter)
@EsikAntony
EsikAntony / EnumDozerConverter.java
Last active May 20, 2016 08:33
Dozer enum coverter, which respect JAXB generated enums with value() and fromValue() methods
package ru.aesik.dozer.converter;
import org.dozer.DozerConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.ReflectionUtils;
import javax.xml.bind.annotation.XmlEnum;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;