added
test
This commit is contained in:
parent
091d14c2fc
commit
7282b0493b
|
@ -0,0 +1,54 @@
|
|||
package com.loafle.overflow.module.apikey.dao;
|
||||
|
||||
import com.loafle.overflow.AppConfig;
|
||||
import com.loafle.overflow.JdbcConfiguration;
|
||||
import com.loafle.overflow.module.apikey.model.ApiKey;
|
||||
import com.loafle.overflow.module.domain.Domain;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 23.
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
||||
public class ApiKeyDAOTest {
|
||||
|
||||
@Autowired
|
||||
private ApiKeyDAO apiKeyDAO;
|
||||
|
||||
@Test
|
||||
public void create() {
|
||||
|
||||
ApiKey apiKey = new ApiKey();
|
||||
|
||||
apiKey.setApiKey("52abd6fd57e511e7ac52080027658d13");
|
||||
|
||||
Domain domain = new Domain();
|
||||
domain.setId(1);
|
||||
|
||||
apiKey.setDomain(domain);
|
||||
|
||||
this.apiKeyDAO.save(apiKey);
|
||||
|
||||
|
||||
Assert.assertNotEquals(apiKey.getId(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findByApiKey() throws Exception {
|
||||
|
||||
ApiKey apiKey = this.apiKeyDAO.findByApiKey("52abd6fd57e511e7ac52080027658d13");
|
||||
|
||||
|
||||
Assert.assertNotEquals(apiKey, null);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user