1. Project Clover database mer. févr. 4 2026 12:48:28 CET
  2. Package org.devacfr.maven.skins.reflow.snippet

File SnippetComponentTest.java

 

Code metrics

0
6
2
1
43
22
2
0,33
3
2
1

Classes

Class Line # Actions
SnippetComponentTest 25 6 0% 2 0
1.0100%
 

Contributing tests

This file is covered by 2 tests. .

Source view

1    /*
2    * Copyright 2012-2025 Christophe Friederich
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16    package org.devacfr.maven.skins.reflow.snippet;
17   
18    import org.devacfr.maven.skins.reflow.JsoupUtils;
19    import org.devacfr.maven.skins.reflow.snippet.SnippetComponent.Type;
20    import org.devacfr.testing.jupiter.MockitoTestCase;
21    import org.jsoup.nodes.Element;
22    import org.junit.jupiter.api.DisplayName;
23    import org.junit.jupiter.api.Test;
24   
 
25    public class SnippetComponentTest extends MockitoTestCase {
26   
 
27  2 toggle @Test()
28    @DisplayName("should return attribute true value for valueless attribute")
29    public void shouldReturnTrueForValuelessAttribute() {
30  2 SnippetComponent<?> snippet = SnippetComponent
31    .createSnippet(createElement("<test attr1 attr2=\"true\"></test>"), null, Type.webComponent);
32  2 assertNotNull(snippet);
33  2 assertEquals("true", snippet.getAttribute("attr2"));
34  2 assertTrue(snippet.hasAttribute("attr1"));
35  2 assertEquals("true", snippet.getAttrs().get("attr1"));
36   
37    }
38   
 
39  2 toggle private static Element createElement(final String html) {
40  2 return JsoupUtils.createHtmlDocument(html).body().firstElementChild();
41    }
42   
43    }