Skip to main content
summaryrefslogtreecommitdiffstats
blob: 3d4d1bb277b961bef55720ce6ab7148e78ae0c07 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*******************************************************************************
 * Copyright (c) 2007, 2015 Oracle. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
 * 
 * Contributors:
 *     Oracle - initial API and implementation
 ******************************************************************************/
package org.eclipse.jpt.common.utility.tests.internal.reference;

import org.eclipse.jpt.common.utility.internal.reference.SimpleIntReference;
import org.eclipse.jpt.common.utility.reference.ModifiableIntReference;
import org.eclipse.jpt.common.utility.tests.internal.TestTools;

public class SimpleIntReferenceTests
	extends ModifiableIntReferenceTests
{
	public SimpleIntReferenceTests(String name) {
		super(name);
	}

	@Override
	protected ModifiableIntReference buildIntReference(int value) {
		return new SimpleIntReference(value);
	}

	public void testCtors() {
		SimpleIntReference ir;
		ir = new SimpleIntReference();
		assertEquals(0, ir.getValue());
		ir = new SimpleIntReference(7);
		assertEquals(7, ir.getValue());
		ir = new SimpleIntReference(-7);
		assertEquals(-7, ir.getValue());
	}

	public void testClone() {
		SimpleIntReference ir1 = new SimpleIntReference(44);
		SimpleIntReference ir2 = ir1.clone();
		assertEquals(44, ir2.getValue());
		assertNotSame(ir1, ir2);
	}

	public void testSerialization() throws Exception {
		SimpleIntReference ir1 = new SimpleIntReference(44);
		SimpleIntReference ir2 = TestTools.serialize(ir1);
		assertEquals(44, ir2.getValue());
		assertNotSame(ir1, ir2);
	}
}

Back to the top