Subversion Repositories SmartDukaan

Rev

Rev 3024 | Rev 3269 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3024 mandeep.dh 1
/**
2
 * 
3
 */
4
package in.shop2020.crm.handler;
5
 
6
import static org.junit.Assert.assertEquals;
7
import in.shop2020.crm.domain.Ticket;
8
 
9
import java.util.Date;
10
import java.util.List;
11
 
12
import org.apache.thrift.TException;
13
import org.junit.Before;
3029 mandeep.dh 14
import org.junit.Ignore;
3024 mandeep.dh 15
import org.junit.Test;
16
import org.springframework.beans.factory.annotation.Autowired;
17
import org.springframework.context.ApplicationContext;
18
import org.springframework.context.support.ClassPathXmlApplicationContext;
19
 
20
/**
21
 * Unit test cases for TicketHandler
22
 *
23
 * @author mandeep
24
 */
25
public class TicketHandlerTest {
26
 
27
    @Autowired
28
    private TicketHandler ticketHandler;
29
 
30
    /**
31
     * @throws java.lang.Exception
32
     */
33
    @Before
34
    public void setUp() throws Exception
35
    {
36
        ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:context.xml");
37
        ticketHandler = ctx.getBean(TicketHandler.class);
38
    }
39
 
40
    /**
41
     * Test method for {@link in.shop2020.crm.handler.TicketHandler#fetchTickets(long, long)}.
42
     * @throws TException 
43
     */
3029 mandeep.dh 44
    @Ignore
3024 mandeep.dh 45
    public void testFetchTickets() throws TException {
46
        List<Ticket> tickets = ticketHandler.getTickets(123);
47
        assertEquals(5, tickets.size());
48
        tickets = ticketHandler.getTickets(123);
49
        assertEquals(4, tickets.size());
50
        tickets = ticketHandler.getTickets(123);
51
        assertEquals(9, tickets.size());
52
    }
53
 
54
    /**
55
     * Test method for {@link in.shop2020.crm.handler.TicketHandler#updateTicket(in.shop2020.crm.domain.Ticket)}.
56
     * @throws TException 
57
     */
3029 mandeep.dh 58
    @Ignore
3024 mandeep.dh 59
    public void testUpdateTicket() throws TException {
60
        List<Ticket> tickets = ticketHandler.getTickets(99);
61
        Ticket ticket = tickets.get(0);
62
        ticketHandler.updateTicket(ticket);
63
    }
64
 
65
    /**
66
     * Test method for {@link in.shop2020.crm.handler.TicketHandler#insertTicket(in.shop2020.crm.domain.Ticket)}.
67
     * @throws TException 
68
     */
3029 mandeep.dh 69
    @Ignore
3024 mandeep.dh 70
    public void testInsertTicket() throws TException {
71
        Ticket ticket = new Ticket();
72
        ticket.setCustomerId(0);
73
        ticket.setCloseDate(new Date());
74
        ticket.setOpenDate(new Date());
75
        ticketHandler.insertTicket(ticket);
76
 
77
        assertEquals(true, ticket.getId() > 10);
78
    }
79
}