1024N/A/*
1024N/A * CDDL HEADER START
1024N/A *
1024N/A * The contents of this file are subject to the terms of the
1024N/A * Common Development and Distribution License (the "License").
1024N/A * You may not use this file except in compliance with the License.
1024N/A *
1024N/A * See LICENSE.txt included in this distribution for the specific
1024N/A * language governing permissions and limitations under the License.
1024N/A *
1024N/A * When distributing Covered Code, include this CDDL HEADER in each
1024N/A * file and include the License file at LICENSE.txt.
1024N/A * If applicable, add the following below this CDDL HEADER, with the
1024N/A * fields enclosed by brackets "[]" replaced with your own identifying
1024N/A * information: Portions Copyright [yyyy] [name of copyright owner]
1024N/A *
1024N/A * CDDL HEADER END
1024N/A */
1024N/A
1024N/A/*
1024N/A * Copyright 2010 Sun Micosystems. All rights reserved.
1024N/A * Use is subject to license terms.
1024N/A */
1024N/A
531N/Apackage org.opensolaris.opengrok.history;
531N/A
531N/Aimport org.junit.After;
531N/Aimport org.junit.AfterClass;
531N/Aimport org.junit.Before;
531N/Aimport org.junit.BeforeClass;
531N/Aimport org.junit.Test;
531N/Aimport static org.junit.Assert.*;
531N/A
531N/A/**
531N/A *
531N/A * @author austvik
531N/A */
531N/Apublic class AnnotationTest {
531N/A
531N/A public AnnotationTest() {
531N/A }
531N/A
531N/A @BeforeClass
531N/A public static void setUpClass() throws Exception {
531N/A }
531N/A
531N/A @AfterClass
531N/A public static void tearDownClass() throws Exception {
531N/A }
531N/A
531N/A @Before
531N/A public void setUp() {
531N/A }
531N/A
531N/A @After
531N/A public void tearDown() {
531N/A }
531N/A
531N/A /**
531N/A * Test of getRevision method, of class Annotation.
531N/A */
531N/A @Test
531N/A public void getRevision() {
531N/A Annotation instance = new Annotation("testfile.tst");
531N/A assertEquals(instance.getRevision(1), "");
1384N/A instance.addLine("1.0", "Author");
531N/A assertEquals(instance.getRevision(1), "1.0");
1384N/A instance.addLine("1.1.0", "Author 2");
531N/A assertEquals(instance.getRevision(2), "1.1.0");
531N/A }
531N/A
531N/A /**
531N/A * Test of getAuthor method, of class Annotation.
531N/A */
531N/A @Test
531N/A public void getAuthor() {
531N/A Annotation instance = new Annotation("testfile.tst");
531N/A assertEquals(instance.getAuthor(1), "");
1384N/A instance.addLine("1.0", "Author");
531N/A assertEquals(instance.getAuthor(1), "Author");
1384N/A instance.addLine("1.1.0", "Author 2");
531N/A assertEquals(instance.getAuthor(2), "Author 2");
531N/A }
531N/A
531N/A /**
531N/A * Test of size method, of class Annotation.
531N/A */
531N/A @Test
531N/A public void size() {
531N/A Annotation instance = new Annotation("testfile.tst");
531N/A assertEquals(instance.size(), 0);
1384N/A instance.addLine("1.0", "Author");
531N/A assertEquals(instance.size(), 1);
1384N/A instance.addLine("1.1", "Author 2");
531N/A assertEquals(instance.size(), 2);
531N/A }
531N/A
531N/A /**
531N/A * Test of getWidestRevision method, of class Annotation.
531N/A */
531N/A @Test
531N/A public void getWidestRevision() {
531N/A Annotation instance = new Annotation("testfile.tst");
531N/A assertEquals(instance.getWidestRevision(), 0);
1384N/A instance.addLine("1.0", "Author");
531N/A assertEquals(instance.getWidestRevision(), 3);
1384N/A instance.addLine("1.1.0", "Author 2");
531N/A assertEquals(instance.getWidestRevision(), 5);
531N/A }
531N/A
531N/A /**
531N/A * Test of getWidestAuthor method, of class Annotation.
531N/A */
531N/A @Test
531N/A public void getWidestAuthor() {
531N/A Annotation instance = new Annotation("testfile.tst");
531N/A assertEquals(instance.getWidestAuthor(), 0);
1384N/A instance.addLine("1.0", "Author");
531N/A assertEquals(instance.getWidestAuthor(), 6);
1384N/A instance.addLine("1.1.0", "Author 2");
531N/A assertEquals(instance.getWidestAuthor(), 8);
531N/A }
531N/A
531N/A /**
531N/A * Test of addLine method, of class Annotation.
531N/A */
531N/A @Test
531N/A public void addLine() {
531N/A Annotation instance = new Annotation("testfile.tst");
1384N/A instance.addLine("1.0", "Author");
531N/A assertEquals(instance.size(), 1);
1384N/A instance.addLine(null, null);
531N/A }
531N/A
531N/A /**
531N/A * Test of getFilename method, of class Annotation.
531N/A */
531N/A @Test
531N/A public void getFilename() {
531N/A Annotation instance = new Annotation("testfile.tst");
531N/A assertEquals("testfile.tst", instance.getFilename());
531N/A }
531N/A
1024N/A}