View Javadoc
1   /*
2   Copyright 2011, Aiki IT, FotoRenamer
3   Licensed under the Apache License, Version 2.0 (the "License");
4   you may not use this file except in compliance with the License.
5   You may obtain a copy of the License at
6   
7       http://www.apache.org/licenses/LICENSE-2.0
8   
9   Unless required by applicable law or agreed to in writing, software
10  distributed under the License is distributed on an "AS IS" BASIS,
11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  See the License for the specific language governing permissions and
13  limitations under the License.
14  */
15  package de.aikiit.fotorenamer.gui;
16  
17  import org.junit.jupiter.api.Disabled;
18  import org.junit.jupiter.api.Test;
19  
20  import static org.junit.jupiter.api.Assertions.assertEquals;
21  import static org.junit.jupiter.api.Assertions.assertNotNull;
22  
23  /**
24   * @author hirsch
25   * @version 2011-04-03, 20:24
26   */
27  @Disabled("Not working in travis.")
28  class ProgressBarTest {
29      private static final String TEXT = "Text";
30  
31      /**
32       * Check progress bar initialization and value setting.
33       */
34      @Test
35      void checkInitAndDefaults() {
36          ProgressBar bar = new ProgressBar(0);
37          assertNotNull(bar);
38          assertEquals("", bar.getText());
39          assertEquals(0, bar.getProgress());
40      }
41  
42      /**
43       * Manually set values and retrieve these values.
44       */
45      @Test
46      void checkSetterGetter() {
47          ProgressBar bar = new ProgressBar(10);
48          assertNotNull(bar);
49          bar.setProgress();
50          bar.setProgress();
51          bar.setProgress();
52          bar.setProgress();
53          bar.setProgress();
54          assertEquals(4, bar.getProgress());
55          bar.setText(TEXT);
56          assertEquals(TEXT, bar.getText());
57          // verify that no exception is thrown here
58          bar.updateUI();
59      }
60  }