1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.tests
.request
;
15 import junit
.framework
.TestCase
;
17 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEvent
;
18 import org
.eclipse
.linuxtools
.tmf
.request
.TmfDataRequest
;
19 import org
.eclipse
.linuxtools
.tmf
.request
.TmfDataRequestStub
;
22 * <b><u>TmfDataRequestTest</u></b>
24 * TODO: Implement me. Please.
26 public class TmfDataRequestTest
extends TestCase
{
28 // ------------------------------------------------------------------------
30 // ------------------------------------------------------------------------
32 public TmfDataRequestTest(String name
) {
37 protected void setUp() throws Exception
{
42 protected void tearDown() throws Exception
{
46 // ------------------------------------------------------------------------
48 // ------------------------------------------------------------------------
50 public void testTmfDataRequest() {
51 TmfDataRequest
<TmfEvent
> request
= new TmfDataRequestStub
<TmfEvent
>(TmfEvent
.class);
53 assertEquals("getIndex", 0, request
.getIndex());
54 assertEquals("getNbRequestedEvents", TmfDataRequest
.ALL_DATA
, request
.getNbRequested());
55 assertEquals("getBlockize", TmfDataRequest
.DEFAULT_BLOCK_SIZE
, request
.getBlockize());
58 public void testTmfDataRequestIndex() {
59 TmfDataRequest
<TmfEvent
> request
= new TmfDataRequestStub
<TmfEvent
>(TmfEvent
.class, 10);
61 assertEquals("getIndex", 10, request
.getIndex());
62 assertEquals("getNbRequestedEvents", TmfDataRequest
.ALL_DATA
, request
.getNbRequested());
63 assertEquals("getBlockize", TmfDataRequest
.DEFAULT_BLOCK_SIZE
, request
.getBlockize());
66 public void testTmfDataRequestIndexNbRequested() {
67 TmfDataRequest
<TmfEvent
> request
= new TmfDataRequestStub
<TmfEvent
>(TmfEvent
.class, 10, 100);
69 assertEquals("getIndex", 10, request
.getIndex());
70 assertEquals("getNbRequestedEvents", 100, request
.getNbRequested());
71 assertEquals("getBlockize", TmfDataRequest
.DEFAULT_BLOCK_SIZE
, request
.getBlockize());
74 public void testTmfDataRequestIndexNbEventsBlocksize() {
75 TmfDataRequest
<TmfEvent
> request
= new TmfDataRequestStub
<TmfEvent
>(TmfEvent
.class, 10, 100, 200);
77 assertEquals("getIndex", 10, request
.getIndex());
78 assertEquals("getNbRequestedEvents", 100, request
.getNbRequested());
79 assertEquals("getBlockize", 200, request
.getBlockize());
82 // ------------------------------------------------------------------------
84 // ------------------------------------------------------------------------
86 public void testEquals_Reflexivity() {
87 TmfDataRequest
<TmfEvent
> request
= new TmfDataRequestStub
<TmfEvent
>(TmfEvent
.class, 10, 100, 200);
89 assertTrue("request.equals(request)", request
.equals(request
));
92 public void testEquals_Symmetry() {
93 TmfDataRequest
<TmfEvent
> request1
= new TmfDataRequestStub
<TmfEvent
>(TmfEvent
.class, 10, 100, 200);
94 TmfDataRequest
<TmfEvent
> request2
= new TmfDataRequestStub
<TmfEvent
>(TmfEvent
.class, 10, 100, 200);
95 TmfDataRequest
<TmfEvent
> request3
= new TmfDataRequestStub
<TmfEvent
>(TmfEvent
.class, 20, 100, 200);
97 assertTrue("request1.equals(request2)", request1
.equals(request2
));
98 assertTrue("request2.equals(request1)", request2
.equals(request1
));
100 assertFalse("request1.equals(request3)", request1
.equals(request3
));
101 assertFalse("request3.equals(request1)", request3
.equals(request1
));
102 assertFalse("request2.equals(request3)", request2
.equals(request3
));
103 assertFalse("request3.equals(request2)", request3
.equals(request2
));
106 public void testEquals_Transivity() {
107 TmfDataRequest
<TmfEvent
> request1
= new TmfDataRequestStub
<TmfEvent
>(TmfEvent
.class, 10, 100, 200);
108 TmfDataRequest
<TmfEvent
> request2
= new TmfDataRequestStub
<TmfEvent
>(TmfEvent
.class, 10, 100, 200);
109 TmfDataRequest
<TmfEvent
> request3
= new TmfDataRequestStub
<TmfEvent
>(TmfEvent
.class, 10, 100, 200);
111 assertTrue("request1.equals(request2)", request1
.equals(request2
));
112 assertTrue("request2.equals(request3)", request2
.equals(request3
));
113 assertTrue("request1.equals(request3)", request1
.equals(request3
));
This page took 0.031972 seconds and 5 git commands to generate.