Bug 584: Increase test coverage
[yangtools.git] / code-generator / binding-generator-util / src / test / java / org / opendaylight / yangtools / binding / generator / util / generated / type / builder / AbstractTypeMemberTest.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.binding.generator.util.generated.type.builder;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
13
14 import org.junit.Test;
15 import org.opendaylight.yangtools.sal.binding.model.api.MethodSignature;
16
17 public class AbstractTypeMemberTest {
18
19     @Test
20     public void testMethodsForAbstractTypeMemberBuilder() {
21         final MethodSignatureBuilderImpl methodSignatureBuilderImpl = new MethodSignatureBuilderImpl("TestProperty");
22         final GeneratedTypeBuilderImpl typeBuilderImpl = new GeneratedTypeBuilderImpl("org.opendaylight.yangtools.test", "TestType");
23         final GeneratedTypeBuilderImpl typeBuilderImpl2 = new GeneratedTypeBuilderImpl("org.opendaylight.yangtools.test", "TestType2");
24         methodSignatureBuilderImpl.setComment("test comment");
25         methodSignatureBuilderImpl.setFinal(true);
26         methodSignatureBuilderImpl.setStatic(true);
27
28         final MethodSignature genProperty = methodSignatureBuilderImpl.toInstance(typeBuilderImpl);
29         final MethodSignature genProperty2 = methodSignatureBuilderImpl.toInstance(typeBuilderImpl2);
30         assertEquals("test comment", genProperty.getComment());
31         assertTrue(genProperty.isFinal());
32         assertTrue(genProperty.isStatic());
33         assertEquals(genProperty.hashCode(), genProperty2.hashCode());
34         String pom = genProperty.toString();
35         assertTrue(genProperty.toString().contains("org.opendaylight.yangtools.test.TestType"));
36         assertTrue(genProperty.equals(genProperty2));
37         assertFalse(genProperty.equals(null));
38
39     }
40 }