Skip to content

Commit

Permalink
Issue #11514: Update pom.xml and fix variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
heyannely authored and romani committed May 21, 2023
1 parent 154ee54 commit 2f55e67
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -874,12 +874,12 @@
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.09</minimum>
<minimum>0.76</minimum>
</limit>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>0.00</minimum>
<minimum>0.75</minimum>
</limit>
</limits>
</rule>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code and other text files for adherence to a set of rules.
// Copyright (C) 2001-2023 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
///////////////////////////////////////////////////////////////////////////////////////////////

package com.puppycrawl.tools.checkstyle.gui;

import static com.google.common.truth.Truth.assertWithMessage;

import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;

import org.junit.jupiter.api.Test;

class BaseCellEditorTest {

@Test
public void testToString() {

final BaseCellEditor cellEditor = new BaseCellEditor();

assertWithMessage("Should return null")
.that(cellEditor.getCellEditorValue() == null)
.isTrue();
}

@Test
public void testStopCellEditing() {

final BaseCellEditor cellEditor = new BaseCellEditor();

assertWithMessage("Should be true")
.that(cellEditor.stopCellEditing())
.isTrue();
}

@Test
public void testFireEditingStoppedAndCanceled() {

final BaseCellEditor cellEditor = new BaseCellEditor();

final boolean[] cellEditorListenerStopped = {false};
final boolean[] cellEditorListenerCanceled = {false};

final CellEditorListener cellEditorListener1 = new CellEditorListener() {

@Override
public void editingStopped(ChangeEvent e) {
cellEditorListenerStopped[0] = true;
}

@Override
public void editingCanceled(ChangeEvent e) {
cellEditorListenerCanceled[0] = true;
}

};

cellEditor.addCellEditorListener(cellEditorListener1);
cellEditor.fireEditingStopped();
assertWithMessage("Editor listener should be stopped")
.that(cellEditorListenerStopped[0])
.isTrue();
cellEditor.fireEditingCanceled();
assertWithMessage("Editor listener should be canceled")
.that(cellEditorListenerCanceled[0])
.isTrue();

}
}

0 comments on commit 2f55e67

Please sign in to comment.