Skip to content

Instantly share code, notes, and snippets.

package task1.adapter.persistence;
import com.google.common.collect.Lists;
import task1.core.User;
import task1.core.UserRepository;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@freekman
freekman / Proxy_Task
Created January 8, 2015 14:24
Proxy Example
package com.clouway.patterns.proxytodell;
/**
* @author Ivan Genchev ([email protected])
*/
//Клиента работи с обект от клас А, но реално вижда че работи само с клас Б.
// Реален клас <- ->Proxy
// Integer class <- ->IntegerProxy
// Да се направи IntegerProxy. Има 1 мениджър (IntegerFactory), който създава инстанции чрез метода си createInstance().
@freekman
freekman / MyTestAnnotation.java
Created January 7, 2015 14:57
Sample Test with annotations
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})
public @interface MyTestAnnotation {
}
@freekman
freekman / SampleTest.java
Created January 7, 2015 14:49
Sample Test
public static class MyTest {
public void testAddTwoNumbers() {
System.out.println("Adding two numbers");
}
public Date testJanuary(int year, int day) {
package com.clouway.networkingandgui.agent;
import com.google.common.io.ByteStreams;
import org.jmock.Expectations;
import org.jmock.integration.junit4.JUnitRuleMockery;
import org.junit.Rule;
import org.junit.Test;
import java.io.File;
import java.io.FileInputStream;