~ubuntu-branches/ubuntu/utopic/eclipse-linuxtools/utopic

« back to all changes in this revision

Viewing changes to rpm/org.eclipse.linuxtools.rpm.ui.editor.tests/src/org/eclipse/linuxtools/rpm/ui/editor/tests/actions/SpecfileChangelogFormatterTest.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2014-05-12 18:11:40 UTC
  • mfrom: (3.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140512181140-w237r3vsah1tmybz
Tags: 2.2.1-1
* New upstream release.
* Refreshed d/patches.
* Removed eclipse-cdt-valgrind-remote package, all its functionality
  is now provided by eclipse-cdt-profiling-framework-remote.
* Added remove-license-feature.patch.
* Bump Standards-Version to 3.9.5.
* Enable eclipse-changelog package.
* Enable eclipse-rpm-editor package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*******************************************************************************
2
 
 * Copyright (c) 2009 Red Hat, Inc.
3
 
 * All rights reserved. This program and the accompanying materials
4
 
 * are made available under the terms of the Eclipse Public License v1.0
5
 
 * which accompanies this distribution, and is available at
6
 
 * http://www.eclipse.org/legal/epl-v10.html
7
 
 * 
8
 
 * Contributors:
9
 
 *     Red Hat - initial API and implementation
10
 
 *******************************************************************************/
11
 
package org.eclipse.linuxtools.rpm.ui.editor.tests.actions;
12
 
 
13
 
import static org.junit.Assert.assertEquals;
14
 
 
15
 
import java.text.MessageFormat;
16
 
import java.text.SimpleDateFormat;
17
 
import java.util.Date;
18
 
 
19
 
import org.eclipse.core.runtime.CoreException;
20
 
import org.eclipse.linuxtools.internal.rpm.ui.editor.actions.SpecfileChangelogFormatter;
21
 
import org.eclipse.linuxtools.rpm.ui.editor.tests.FileTestCase;
22
 
import org.eclipse.ui.IEditorPart;
23
 
import org.eclipse.ui.PlatformUI;
24
 
import org.eclipse.ui.ide.IDE;
25
 
import org.junit.Before;
26
 
import org.junit.Test;
27
 
 
28
 
public class SpecfileChangelogFormatterTest extends FileTestCase {
29
 
 
30
 
        private static final String USER_MAIL = "someone@redhat.com";
31
 
        private static final String USER_NAME = "Alexander Kurtakov";
32
 
        private SpecfileChangelogFormatter formatter;
33
 
        private IEditorPart editor;
34
 
        public final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("EEE MMM d yyyy");
35
 
 
36
 
        @Override
37
 
        @Before
38
 
        public void setUp() throws CoreException {
39
 
                super.setUp();
40
 
                newFile("%changelog");
41
 
                editor = IDE.openEditor(PlatformUI.getWorkbench()
42
 
                                .getActiveWorkbenchWindow().getActivePage(), testFile,
43
 
                                "org.eclipse.linuxtools.rpm.ui.editor.SpecfileEditor");
44
 
                formatter = new SpecfileChangelogFormatter();
45
 
        }
46
 
 
47
 
        @Test
48
 
        public void testFormatDateLine() {
49
 
                String expectedLine = MessageFormat
50
 
                                .format("* {0} {1} <{2}> {3}{4}-{5}", SIMPLE_DATE_FORMAT.format(new Date()), //$NON-NLS-1$
51
 
                                                USER_NAME, USER_MAIL, "", "0", "0");
52
 
                assertEquals(expectedLine,
53
 
                                formatter.formatDateLine(USER_NAME, USER_MAIL));
54
 
        }
55
 
 
56
 
        @Test
57
 
        public void testMergeChangelogStringStringStringIEditorPartStringString() {
58
 
                // TODO find how to test this
59
 
                formatter.mergeChangelog("proba", "", editor, "", "");
60
 
        }
61
 
 
62
 
}