Skip to content

Package: ViewTemplateSupplierUtil_PTest

ViewTemplateSupplierUtil_PTest

nameinstructionbranchcomplexitylinemethod
ViewTemplateSupplierUtil_PTest()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
emptyResource()
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
noTemplate()
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
setUp()
M: 0 C: 1
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
validViewTemplate()
M: 0 C: 34
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 10
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2018 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Lucas Koehler - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.spi.view.template.service;
15:
16: import static org.junit.Assert.assertEquals;
17: import static org.junit.Assert.assertNotNull;
18: import static org.junit.Assert.assertNull;
19:
20: import org.eclipse.emf.common.util.URI;
21: import org.eclipse.emf.ecp.view.template.model.VTStyle;
22: import org.eclipse.emf.ecp.view.template.model.VTViewTemplate;
23: import org.junit.Before;
24: import org.junit.Test;
25:
26: /**
27: * Plugin tests for {@link ViewTemplateSupplierUtil}.
28: * <p>
29: * <strong>Note:</strong> This is a plugin test because otherwise the package registry is not filled with the needed
30: * EPackages.
31: *
32: * @author Lucas Koehler
33: *
34: */
35: public class ViewTemplateSupplierUtil_PTest {
36:
37:         private static final String BASE_URI = "platform:/plugin/org.eclipse.emf.ecp.view.template.service.test/data/"; //$NON-NLS-1$
38:
39:         /**
40:          * @throws java.lang.Exception
41:          */
42:         @Before
43:         public void setUp() throws Exception {
44:         }
45:
46:         @SuppressWarnings("deprecation")
47:         @Test
48:         public void validViewTemplate() {
49:                 final URI templateUri = URI
50:                         .createURI(BASE_URI + "valid.template"); //$NON-NLS-1$
51:                 final VTViewTemplate loadedTemplate = ViewTemplateSupplierUtil.loadViewTemplate(templateUri);
52:
53:                 assertNotNull("The loaded view template must not be null", loadedTemplate); //$NON-NLS-1$
54:                 assertEquals(1, loadedTemplate.getStyles().size());
55:                 final VTStyle style = loadedTemplate.getStyles().get(0);
56:                 assertEquals(1, style.getProperties().size());
57:                 assertNotNull(style.getSelector());
58:                 assertNotNull(loadedTemplate.getControlValidationConfiguration());
59:         }
60:
61:         @Test
62:         public void emptyResource() {
63:                 final URI templateUri = URI
64:                         .createURI(BASE_URI + "empty.template"); //$NON-NLS-1$
65:                 final VTViewTemplate loadedTemplate = ViewTemplateSupplierUtil.loadViewTemplate(templateUri);
66:                 assertNull(loadedTemplate);
67:         }
68:
69:         @Test
70:         public void noTemplate() {
71:                 final URI templateUri = URI
72:                         .createURI(BASE_URI + "noTemplate.template"); //$NON-NLS-1$
73:                 final VTViewTemplate loadedTemplate = ViewTemplateSupplierUtil.loadViewTemplate(templateUri);
74:                 assertNull(loadedTemplate);
75:         }
76: }