Skip to content

Instantly share code, notes, and snippets.

View karian7's full-sized avatar
🎯
Focusing

koasu karian7

🎯
Focusing
View GitHub Profile
package com.daumcorp.be;
import org.junit.Before;
import org.junit.Test;
/**
* Created by karian7 on 2/27/14.
*/
public class AuthServiceTest {
public static final String NOUSER = "nouser@daum.net";
@Configuration
public static class TestConfig {
@Bean
AccountRepository accountRepository() {
return mock(AccountRepository.class);
}
@Bean
GravatarClient gravatarClient() {
return mock(GravatarClient.class);
}
package com.daumcorp.be;
import com.daumcorp.cafe.gravatar.Gravatar;
import com.daumcorp.cafe.gravatar.GravatarClient;
import org.junit.Before;
import org.junit.Test;
import org.mockito.internal.verification.Only;
import java.util.HashMap;
import java.util.Map;
package com.daumcorp.be;
import org.junit.Before;
import org.junit.Test;
import org.postgresql.ds.PGSimpleDataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
package com.daumcorp.be;
import org.junit.Before;
import org.junit.Test;
import org.postgresql.ds.PGSimpleDataSource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-902.jdbc4</version>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.daumcorp.be.CommentRepositoryTest$CommentRepository">
<select id="list" resultType="comment">
select no, email, comment, create_time as createTime from comment
order by no desc
limit #{limit} offset #{offset}
</select>
package com.daumcorp.be;
import org.apache.commons.lang.StringUtils;
/**
* Created by karian7 on 2/18/14.
*/
public class PasswordChangeService {
private AccountRepository accountRepository;
public static class DBAccountRepository implements AccountRepository {
private final NamedParameterJdbcTemplate jdbcTemplate;
public DBAccountRepository(DataSource dataSource) {
jdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
}
@Override
public Account findByEmail(final String email) {
String query = "select email, name, password from account where email = :email and use = 'Y'";