1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugin.eclipse;
20
21 import java.util.HashMap;
22 import java.util.Map;
23
24 import junit.framework.TestCase;
25
26
27
28
29
30
31 public class BuildCommandTest
32 extends TestCase
33 {
34
35
36
37 public void testEquals()
38 {
39 BuildCommand b1 = new BuildCommand( "foobuilder", null, (Map) null );
40 BuildCommand b2 = new BuildCommand( "foobuilder", "", (Map) null );
41 assertEquals( false, b1.equals( b2 ) );
42 assertEquals( false, b2.equals( b1 ) );
43
44 b2 = new BuildCommand( "foobuilder", null, (Map) null );
45 assertEquals( true, b1.equals( b2 ) );
46 assertEquals( true, b2.equals( b1 ) );
47
48 b2 = new BuildCommand( "foobuilder", null, new HashMap() );
49 assertEquals( true, b1.equals( b2 ) );
50 assertEquals( true, b2.equals( b1 ) );
51
52 Map m1 = new HashMap();
53 Map m2 = new HashMap();
54
55 b1 = new BuildCommand( "foobuilder", null, m1 );
56 b2 = new BuildCommand( "foobuilder", null, m2 );
57 assertEquals( true, b1.equals( b2 ) );
58 assertEquals( true, b2.equals( b1 ) );
59
60 m1.put( "arg1", "value1" );
61 m2.put( "arg1", "value1" );
62 b1 = new BuildCommand( "foobuilder", null, m1 );
63 b2 = new BuildCommand( "foobuilder", null, m2 );
64 assertEquals( true, b1.equals( b2 ) );
65 assertEquals( true, b2.equals( b1 ) );
66
67 m2.put( "arg1", "foo" );
68 b1 = new BuildCommand( "foobuilder", null, m1 );
69 b2 = new BuildCommand( "foobuilder", null, m2 );
70 assertEquals( false, b1.equals( b2 ) );
71 assertEquals( false, b2.equals( b1 ) );
72 }
73 }