mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 21:48:22 +02:00
revisted the model to speed up the validation and to have a better control how much revalitaions have to be done when something changes
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
package ninja.javafx.smartcsv.fx.table.model;
|
||||
|
||||
import ninja.javafx.smartcsv.validation.Validator;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
/**
|
||||
* unit test for the value class
|
||||
*/
|
||||
public class CSVValueTest {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// constants
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static final String COLUMN = "COLUMN";
|
||||
static final String VALUE = "VALUE";
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// mocks
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
Validator validator = mock(Validator.class);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// subject under test
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
CSVValue sut;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// init
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Before
|
||||
public void initialize() {
|
||||
sut = new CSVValue();
|
||||
sut.setValidator(validator);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// tests
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Test
|
||||
public void set_value_calls_validation() {
|
||||
//setup
|
||||
sut.setColumn(COLUMN);
|
||||
|
||||
// execution
|
||||
sut.setValue(VALUE);
|
||||
|
||||
// assertion
|
||||
verify(validator).isValid(anyInt(), eq(COLUMN), eq(VALUE));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user