~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfEventRequestTest.java

  • Committer: Package Import Robot
  • Author(s): tony mancill
  • Date: 2013-05-13 21:43:22 UTC
  • mfrom: (1.2.1) (2.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130513214322-6frgd9du1n0w2uo7
Tags: 1.2.1-1
* Team upload.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*******************************************************************************
2
2
 * Copyright (c) 2009, 2010 Ericsson
3
 
 * 
 
3
 *
4
4
 * All rights reserved. This program and the accompanying materials are
5
5
 * made available under the terms of the Eclipse Public License v1.0 which
6
6
 * accompanies this distribution, and is available at
7
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 
 * 
 
8
 *
9
9
 * Contributors:
10
10
 *   Francois Chouinard - Initial API and implementation
11
11
 *******************************************************************************/
26
26
 * <p>
27
27
 * Test suite for the TmfEventRequest class.
28
28
 */
29
 
@SuppressWarnings("nls")
 
29
@SuppressWarnings({"nls","javadoc"})
30
30
public class TmfEventRequestTest extends TestCase {
31
31
 
32
32
        // ------------------------------------------------------------------------
35
35
 
36
36
        private static TmfTimeRange range1 = new TmfTimeRange(TmfTimeRange.ETERNITY);
37
37
        private static TmfTimeRange range2 = new TmfTimeRange(new TmfTimestamp(), TmfTimestamp.BIG_CRUNCH);
38
 
        
 
38
 
39
39
        private static TmfEventRequest<TmfEvent> fRequest1;
40
40
        private static TmfEventRequest<TmfEvent> fRequest1b;
41
41
        private static TmfEventRequest<TmfEvent> fRequest1c;
44
44
        private static TmfEventRequest<TmfEvent> fRequest4;
45
45
 
46
46
        private static int fRequestCount;
47
 
        
 
47
 
48
48
        // ------------------------------------------------------------------------
49
49
        // Housekeeping
50
50
        // ------------------------------------------------------------------------
51
51
 
52
 
        public TmfEventRequestTest(String name) {
 
52
    /**
 
53
     * @param name the test name
 
54
     */
 
55
    public TmfEventRequestTest(final String name) {
53
56
                super(name);
54
57
        }
55
58
 
71
74
                super.tearDown();
72
75
        }
73
76
 
74
 
        private TmfEventRequest<TmfEvent> setupTestRequest(final boolean[] flags) {
75
 
                
 
77
        private static TmfEventRequest<TmfEvent> setupTestRequest(final boolean[] flags) {
 
78
 
76
79
                TmfEventRequest<TmfEvent> request = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, new TmfTimeRange(TmfTimeRange.ETERNITY), 100, 200) {
77
80
                    @Override
78
81
                        public void handleCompleted() {
97
100
                };
98
101
                return request;
99
102
        }
100
 
        
 
103
 
101
104
        // ------------------------------------------------------------------------
102
105
        // Constructors
103
106
        // ------------------------------------------------------------------------
185
188
        // equals
186
189
        // ------------------------------------------------------------------------
187
190
 
188
 
        public void testEqualsReflexivity() throws Exception {
 
191
        public void testEqualsReflexivity() {
189
192
        assertTrue("equals", fRequest1.equals(fRequest1));
190
193
        assertTrue("equals", fRequest2.equals(fRequest2));
191
194
 
193
196
        assertFalse("equals", fRequest2.equals(fRequest1));
194
197
        }
195
198
 
196
 
        public void testEqualsSymmetry() throws Exception {
 
199
        public void testEqualsSymmetry() {
197
200
        assertTrue("equals", fRequest1.equals(fRequest1b));
198
201
        assertTrue("equals", fRequest1b.equals(fRequest1));
199
202
 
202
205
        assertFalse("equals", fRequest3.equals(fRequest1));
203
206
        assertFalse("equals", fRequest3.equals(fRequest2));
204
207
        }
205
 
        
206
 
        public void testEqualsTransivity() throws Exception {
 
208
 
 
209
        public void testEqualsTransivity() {
207
210
        assertTrue("equals", fRequest1.equals(fRequest1b));
208
211
        assertTrue("equals", fRequest1b.equals(fRequest1c));
209
212
        assertTrue("equals", fRequest1.equals(fRequest1c));
210
213
        }
211
 
        
212
 
        public void testEqualsNull() throws Exception {
 
214
 
 
215
        public void testEqualsNull() {
213
216
        assertFalse("equals", fRequest1.equals(null));
214
217
        assertFalse("equals", fRequest2.equals(null));
215
218
        }
218
221
        // hashCode
219
222
        // ------------------------------------------------------------------------
220
223
 
221
 
        public void testHashCode() throws Exception {
 
224
        public void testHashCode() {
222
225
        assertTrue("hashCode", fRequest1.hashCode() == fRequest1.hashCode());
223
226
        assertTrue("hashCode", fRequest2.hashCode() == fRequest2.hashCode());
224
227
                assertTrue("hashCode", fRequest1.hashCode() != fRequest2.hashCode());
225
228
        }
226
 
        
 
229
 
227
230
        // ------------------------------------------------------------------------
228
231
        // toString
229
232
        // ------------------------------------------------------------------------
245
248
        // ------------------------------------------------------------------------
246
249
 
247
250
        public void testDone() {
248
 
                
 
251
 
249
252
                final boolean[] flags = new boolean[4];
250
253
                TmfEventRequest<TmfEvent> request = setupTestRequest(flags);
251
254
                request.done();
265
268
        // ------------------------------------------------------------------------
266
269
 
267
270
        public void testFail() {
268
 
                
 
271
 
269
272
                final boolean[] flags = new boolean[4];
270
273
                TmfEventRequest<TmfEvent> request = setupTestRequest(flags);
271
274
                request.fail();
304
307
        // waitForCompletion
305
308
        // ------------------------------------------------------------------------
306
309
 
307
 
}
 
 
b'\\ No newline at end of file'
 
310
}