mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 13:38:23 +02:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 187002997c | |||
| aa7e38c613 | |||
| 13a41468d4 | |||
| f41979960b | |||
| a7fce854ca | |||
| 4f40418aea | |||
| d7c821d1fe | |||
|
|
49f8003f97 | ||
|
|
5f8383c6a1 | ||
| 03dcf20229 | |||
| 543125812a | |||
| c52f6c0bc8 | |||
| 422bd73bad | |||
| e6672834fb | |||
| 8e0ea66552 | |||
|
|
bf476308a2 |
1
.travis.yml
Normal file
1
.travis.yml
Normal file
@@ -0,0 +1 @@
|
||||
language: java
|
||||
@@ -1,4 +1,5 @@
|
||||
# SmartCSV.fx
|
||||
[](https://travis-ci.org/frosch95/SmartCSV.fx)    
|
||||
## Description
|
||||
A simple JavaFX application to load, save and edit a CSV file and provide a [JSON Table Schema](http://specs.frictionlessdata.io/json-table-schema/) for columns to check the values in the columns.
|
||||
|
||||
@@ -14,7 +15,7 @@ even in a "normal" CSV editor. So I decided to write this simple JavaFX applicat
|
||||
|
||||
[Wiki & Documentation](https://github.com/frosch95/SmartCSV.fx/wiki)
|
||||
|
||||
binary distribution of the [latest release (0.9.2)](https://github.com/frosch95/SmartCSV.fx/releases/download/0.9.2/SmartCSV.fx-0.9.2-SNAPSHOT.zip)
|
||||
binary distribution of the [latest release (1.0.0)](https://github.com/frosch95/SmartCSV.fx/releases/download/1.0.0/SmartCSV.fx-1.0.0.zip)
|
||||
|
||||
## Talks
|
||||
[Introduction](http://javafx.ninja/talks/introduction/)
|
||||
|
||||
14
build.gradle
14
build.gradle
@@ -12,13 +12,15 @@ repositories {
|
||||
}
|
||||
|
||||
javafx {
|
||||
version = "13"
|
||||
modules = [ 'javafx.controls', 'javafx.fxml' ]
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||
testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
|
||||
// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
|
||||
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.2'
|
||||
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.5.2'
|
||||
testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '2.2'
|
||||
testCompile group: 'org.mockito', name: 'mockito-core', version:'3.1.0'
|
||||
compile group: 'org.codehaus.groovy', name: 'groovy-all', version: '3.0.0-beta-3'
|
||||
compile group: 'org.springframework', name:'spring-context', version: '5.2.0.RELEASE'
|
||||
compile group: 'net.sf.supercsv', name: 'super-csv', version: '2.4.0'
|
||||
@@ -34,6 +36,10 @@ dependencies {
|
||||
compile group: 'org.fxmisc.richtext', name: 'richtextfx', version: '0.10.2'
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
group 'ninja.javafx'
|
||||
version '0.9.2-SNAPSHOT'
|
||||
version '1.0.0'
|
||||
mainClassName = 'ninja.javafx.smartcsv.Main'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,3 +1,29 @@
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
package ninja.javafx.smartcsv;
|
||||
|
||||
import ninja.javafx.smartcsv.fx.SmartCSV;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,9 +1,34 @@
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
package ninja.javafx.smartcsv.export;
|
||||
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import ninja.javafx.smartcsv.fx.table.model.CSVModel;
|
||||
import ninja.javafx.smartcsv.validation.ValidationError;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.StringWriter;
|
||||
|
||||
@@ -1,3 +1,29 @@
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
package ninja.javafx.smartcsv.files;
|
||||
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +30,7 @@ import javafx.application.Application;
|
||||
import javafx.application.Platform;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.stage.Stage;
|
||||
import ninja.javafx.smartcsv.fx.about.AboutController;
|
||||
import org.springframework.context.annotation.*;
|
||||
@@ -87,6 +88,7 @@ public class SmartCSV extends Application {
|
||||
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.setTitle(String.format("%s %s", name, version));
|
||||
primaryStage.getIcons().add(new Image(SmartCSV.class.getResourceAsStream("/ninja/javafx/smartcsv/icon/logo.png")));
|
||||
primaryStage.show();
|
||||
primaryStage.setMaximized(true);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
package ninja.javafx.smartcsv.fx;
|
||||
|
||||
import javafx.beans.InvalidationListener;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.WeakListChangeListener;
|
||||
@@ -55,10 +56,10 @@ import ninja.javafx.smartcsv.fx.util.LoadFileService;
|
||||
import ninja.javafx.smartcsv.fx.util.SaveFileService;
|
||||
import ninja.javafx.smartcsv.fx.validation.ValidationEditorController;
|
||||
import ninja.javafx.smartcsv.preferences.*;
|
||||
import ninja.javafx.smartcsv.validation.configuration.ValidationConfiguration;
|
||||
import ninja.javafx.smartcsv.validation.ValidationError;
|
||||
import ninja.javafx.smartcsv.validation.ValidationFileReader;
|
||||
import ninja.javafx.smartcsv.validation.ValidationFileWriter;
|
||||
import ninja.javafx.smartcsv.validation.configuration.ValidationConfiguration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -656,6 +657,10 @@ public class SmartCSVController extends FXMLController {
|
||||
addColumn(column, tableView);
|
||||
}
|
||||
|
||||
tableView.getColumns().addListener(
|
||||
(InvalidationListener) observable -> currentCsvFile.getContent().setHeader(
|
||||
tableView.getColumns().stream().map((x) -> x.getText()).toArray(String[]::new)));
|
||||
|
||||
tableView.getItems().setAll(currentCsvFile.getContent().getRows());
|
||||
tableView.setEditable(true);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,3 +1,29 @@
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
package ninja.javafx.smartcsv.fx.list;
|
||||
|
||||
import javafx.application.Platform;
|
||||
@@ -9,9 +35,6 @@ import javafx.scene.layout.Region;
|
||||
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
/**
|
||||
* Created by abi on 05.08.2016.
|
||||
*/
|
||||
public class GotoLineDialog extends Dialog<Integer> {
|
||||
|
||||
private final GridPane grid;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -125,7 +125,7 @@ public class EditableValidationCell extends TableCell<CSVRow, CSVValue> {
|
||||
});
|
||||
}
|
||||
|
||||
private class ValueTextField extends TextField {
|
||||
private static class ValueTextField extends TextField {
|
||||
private CSVValue value;
|
||||
|
||||
public ValueTextField(CSVValue value) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -47,7 +47,6 @@ public class ObservableMapValueFactory implements
|
||||
@Override
|
||||
public ObjectProperty<CSVValue> call(TableColumn.CellDataFeatures<CSVRow, CSVValue> features) {
|
||||
CSVRow row = features.getValue();
|
||||
ObjectProperty<CSVValue> value = row.getColumns().get(key);
|
||||
return value;
|
||||
return row.getColumns().get(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,3 +1,29 @@
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
package ninja.javafx.smartcsv.fx.table.model;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -43,7 +43,6 @@ import static ninja.javafx.smartcsv.preferences.QuoteModeHelper.getQuoteMode;
|
||||
*/
|
||||
public class PreferencesFileReader implements FileReader<CsvPreference> {
|
||||
|
||||
private Map config;
|
||||
private CsvPreference csvPreference;
|
||||
|
||||
public PreferencesFileReader() {
|
||||
@@ -54,7 +53,7 @@ public class PreferencesFileReader implements FileReader<CsvPreference> {
|
||||
|
||||
@Override
|
||||
public void read(File filename) throws IOException {
|
||||
config = new GsonBuilder().create().fromJson(new java.io.FileReader(filename), HashMap.class);
|
||||
Map config = new GsonBuilder().create().fromJson(new java.io.FileReader(filename), HashMap.class);
|
||||
|
||||
if (config != null) {
|
||||
char quoteChar = config.get("quoteChar").toString().charAt(0);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -37,11 +37,11 @@ import org.codehaus.groovy.control.CompilationFailedException;
|
||||
public class GroovyValidation extends EmptyValueIsValid {
|
||||
|
||||
private String groovyScript;
|
||||
private GroovyShell shell = new GroovyShell();
|
||||
private Script script;
|
||||
|
||||
public GroovyValidation(String groovyScript) {
|
||||
this.groovyScript = groovyScript;
|
||||
GroovyShell shell = new GroovyShell();
|
||||
script = shell.parse(groovyScript);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -34,6 +34,7 @@ import java.util.UUID;
|
||||
*/
|
||||
public class UuidValidation extends EmptyValueIsValid {
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
@Override
|
||||
public void check(int row, String value, ValidationError error) {
|
||||
try {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
application.name = SmartCSV.fx
|
||||
application.version = 0.9.1
|
||||
application.version = 1.0.0
|
||||
|
||||
# fxml views
|
||||
fxml.smartcvs.view = /ninja/javafx/smartcsv/fx/smartcsv.fxml
|
||||
|
||||
BIN
src/main/resources/ninja/javafx/smartcsv/icon/logo.afdesign
Normal file
BIN
src/main/resources/ninja/javafx/smartcsv/icon/logo.afdesign
Normal file
Binary file not shown.
BIN
src/main/resources/ninja/javafx/smartcsv/icon/logo.png
Normal file
BIN
src/main/resources/ninja/javafx/smartcsv/icon/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 750 B |
BIN
src/main/resources/ninja/javafx/smartcsv/icon/logo_256x256.png
Normal file
BIN
src/main/resources/ninja/javafx/smartcsv/icon/logo_256x256.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
BIN
src/main/resources/ninja/javafx/smartcsv/icon/logo_32x32.png
Normal file
BIN
src/main/resources/ninja/javafx/smartcsv/icon/logo_32x32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
BIN
src/main/resources/ninja/javafx/smartcsv/icon/logo_64x64.png
Normal file
BIN
src/main/resources/ninja/javafx/smartcsv/icon/logo_64x64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
109
src/test/java/ninja/javafx/smartcsv/files/FileStorageTest.java
Normal file
109
src/test/java/ninja/javafx/smartcsv/files/FileStorageTest.java
Normal file
@@ -0,0 +1,109 @@
|
||||
package ninja.javafx.smartcsv.files;
|
||||
|
||||
import ninja.javafx.smartcsv.FileReader;
|
||||
import ninja.javafx.smartcsv.FileWriter;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
public class FileStorageTest {
|
||||
|
||||
private FileReader<String> reader;
|
||||
private FileWriter<String> writer;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// subject under test
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private FileStorage<String> sut;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// init
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@BeforeEach
|
||||
public void initialize() {
|
||||
reader = mock(FileReader.class);
|
||||
writer = mock(FileWriter.class);
|
||||
sut = new FileStorage<>(reader, writer);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// tests
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Test
|
||||
public void setFile_ShouldStoreFile() {
|
||||
|
||||
// pre execution assertion
|
||||
assertThat("get file returns null", sut.getFile(), nullValue());
|
||||
assertThat("property is null", sut.fileProperty().isNull().get(), equalTo(true));
|
||||
|
||||
// execution
|
||||
final File file = new File("file");
|
||||
sut.setFile(file);
|
||||
|
||||
// assertion
|
||||
assertThat("get file returns the file", sut.getFile(), sameInstance(file));
|
||||
assertThat("property is not null", sut.fileProperty().isNull().get(), equalTo(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void load_ShouldReadContentFromReader() throws Exception {
|
||||
// setup
|
||||
final File file = new File("file");
|
||||
sut.setFile(file);
|
||||
when(reader.getContent()).thenReturn("CONTENT");
|
||||
|
||||
// execution
|
||||
sut.load();
|
||||
|
||||
// assertion
|
||||
verify(reader).read(file);
|
||||
assertThat("content is set", sut.getContent(), equalTo("CONTENT"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void load_ShouldResetFileChangedProperty() throws Exception {
|
||||
// setup
|
||||
sut.setFileChanged(true);
|
||||
when(reader.getContent()).thenReturn("CONTENT");
|
||||
|
||||
// execution
|
||||
sut.load();
|
||||
|
||||
// assertion
|
||||
assertThat("file changed is reset", sut.isFileChanged(), equalTo(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_ShouldWriteContentToWriter() throws Exception {
|
||||
// setup
|
||||
final String content = "CONTENT";
|
||||
sut.setContent(content);
|
||||
final File file = new File("file");
|
||||
sut.setFile(file);
|
||||
|
||||
// execution
|
||||
sut.save();
|
||||
|
||||
// assertion
|
||||
verify(writer).setContent(content);
|
||||
verify(writer).write(file);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_ShouldResetFileChangedProperty() throws Exception {
|
||||
// setup
|
||||
sut.setFileChanged(true);
|
||||
|
||||
// execution
|
||||
sut.save();
|
||||
|
||||
// assertion
|
||||
assertThat("file changed is reset", sut.isFileChanged(), equalTo(false));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
package ninja.javafx.smartcsv.fx.table.model;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.assertThat;
|
||||
@@ -39,14 +39,13 @@ public class CSVModelTest {
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// constants
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static final String TESTHEADER = "TESTHEADER";
|
||||
static final String TESTVALUE = "TESTVALUE";
|
||||
static final String FILEPATH = "filepath";
|
||||
private static final String TESTHEADER = "TESTHEADER";
|
||||
private static final String TESTVALUE = "TESTVALUE";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// subject under test
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
CSVModel sut = new CSVModel();
|
||||
private CSVModel sut = new CSVModel();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// tests
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ninja.javafx.smartcsv.fx.table.model;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.hasKey;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
@@ -14,13 +14,13 @@ public class CSVRowTest {
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// constants
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static final String COLUMN = "COLUMN";
|
||||
static final String VALUE = "VALUE";
|
||||
private static final String COLUMN = "COLUMN";
|
||||
private static final String VALUE = "VALUE";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// subject under test
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
CSVRow sut = new CSVRow();
|
||||
private CSVRow sut = new CSVRow();
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -39,18 +39,19 @@ public class CharsetHelperTest {
|
||||
public void getCharsetName_known_charset() {
|
||||
String result = CharsetHelper.getCharsetName("UTF-16");
|
||||
assertEquals(StandardCharsets.UTF_16.name(), result);
|
||||
assertNotEquals(StandardCharsets.UTF_16.name(), Charset.defaultCharset());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCharsetName_unknown_charset() {
|
||||
String result = CharsetHelper.getCharsetName("foobar");
|
||||
assertEquals(StandardCharsets.UTF_8.name(), result);
|
||||
assertEquals(Charset.defaultCharset().name(), result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCharsetName_null_charset() {
|
||||
String result = CharsetHelper.getCharsetName(null);
|
||||
assertEquals(StandardCharsets.UTF_8.name(), result);
|
||||
assertEquals(Charset.defaultCharset().name(), result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The MIT License (MIT)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2015-2016 javafx.ninja <info@javafx.ninja>
|
||||
Copyright (c) 2015-2019 javafx.ninja <info@javafx.ninja>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -29,17 +29,15 @@ package ninja.javafx.smartcsv.validation;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import ninja.javafx.smartcsv.validation.configuration.ValidationConfiguration;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static java.util.stream.Collectors.joining;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@@ -47,50 +45,22 @@ import static org.junit.Assert.assertTrue;
|
||||
/**
|
||||
* unit test for header validator
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
public class HeaderValidationTest {
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// parameters
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private ValidationConfiguration config;
|
||||
private Boolean expectedResult;
|
||||
private List<ValidationMessage> expectedErrors;
|
||||
private String[] headerNames;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// subject under test
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private Validator sut;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// parameterized constructor
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
public HeaderValidationTest(String configHeaderNames,
|
||||
String[] headerNames,
|
||||
Boolean expectedResult,
|
||||
List<ValidationMessage> expectedErrors) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
this.config = gson.fromJson(configHeaderNames, ValidationConfiguration.class);
|
||||
this.headerNames = headerNames;
|
||||
this.expectedResult = expectedResult;
|
||||
this.expectedErrors = expectedErrors;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// init
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Before
|
||||
public void initialize() {
|
||||
sut = new Validator(config, new TestColumnValueProvider());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// tests
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Test
|
||||
public void validation() {
|
||||
@ParameterizedTest
|
||||
@MethodSource("validationConfigurations")
|
||||
public void validation(String configHeaderNames,
|
||||
String[] headerNames,
|
||||
Boolean expectedResult,
|
||||
List<ValidationMessage> expectedErrors) {
|
||||
// setup
|
||||
Gson gson = new GsonBuilder().create();
|
||||
ValidationConfiguration config = gson.fromJson(configHeaderNames, ValidationConfiguration.class);
|
||||
Validator sut = new Validator(config, new TestColumnValueProvider());
|
||||
|
||||
// execution
|
||||
ValidationError result = sut.isHeaderValid(headerNames);
|
||||
|
||||
@@ -104,17 +74,17 @@ public class HeaderValidationTest {
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// parameters for tests
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Parameterized.Parameters
|
||||
public static Collection validationConfigurations() {
|
||||
return asList(new Object[][] {
|
||||
{ json(), new String[] {}, true, null },
|
||||
{ json("a"), new String[] {"a"}, true, null },
|
||||
{ json("a"), new String[] {"b"}, false, singletonList(new ValidationMessage("validation.message.header.match", "0", "a", "b"))},
|
||||
{ json("a"), new String[] {"a","b"}, false, singletonList(new ValidationMessage("validation.message.header.length", "2", "1"))},
|
||||
{ json("a", "b"), new String[] {"b", "a"}, false, asList(new ValidationMessage("validation.message.header.match", "0", "a", "b"), new ValidationMessage("validation.message.header.match", "1", "b", "a")) }
|
||||
});
|
||||
public static Stream<Arguments> validationConfigurations() {
|
||||
return Stream.of(
|
||||
Arguments.of( json(), new String[] {}, true, null ),
|
||||
Arguments.of( json("a"), new String[] {"a"}, true, null ),
|
||||
Arguments.of( json("a"), new String[] {"b"}, false, singletonList(new ValidationMessage("validation.message.header.match", "0", "a", "b"))),
|
||||
Arguments.of( json("a"), new String[] {"a","b"}, false, singletonList(new ValidationMessage("validation.message.header.length", "2", "1"))),
|
||||
Arguments.of( json("a", "b"), new String[] {"b", "a"}, false, asList(new ValidationMessage("validation.message.header.match", "0", "a", "b"), new ValidationMessage("validation.message.header.match", "1", "b", "a")) )
|
||||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings("StringConcatenationInLoop")
|
||||
public static String json(String... headerNames) {
|
||||
|
||||
String json = "{ \"fields\": [";
|
||||
|
||||
@@ -3,13 +3,12 @@ package ninja.javafx.smartcsv.validation;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import ninja.javafx.smartcsv.validation.configuration.ValidationConfiguration;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.stream.Collectors.joining;
|
||||
@@ -20,59 +19,21 @@ import static org.junit.Assert.assertThat;
|
||||
/**
|
||||
* unit test for validator
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
public class ValidatorTest {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// parameters
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private String config;
|
||||
private String value;
|
||||
private Boolean expectedResult;
|
||||
private ValidationMessage expectedError;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// subject under test
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private Validator sut;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// parameterized constructor
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
public ValidatorTest(String config,
|
||||
String value,
|
||||
Boolean expectedResult,
|
||||
ValidationMessage expectedError) {
|
||||
this.config = config;
|
||||
this.value = value;
|
||||
this.expectedResult = expectedResult;
|
||||
this.expectedError = expectedError;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// init
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Before
|
||||
public void initialize() {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
ValidationConfiguration validationConfiguration = gson.fromJson(config, ValidationConfiguration.class);
|
||||
sut = new Validator(validationConfiguration, new TestColumnValueProvider());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// tests
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Test
|
||||
public void validation() {
|
||||
System.out.println("===================================================");
|
||||
System.out.println(config);
|
||||
System.out.println(value + " " + expectedResult + " " + expectedError);
|
||||
System.out.println("===================================================\n");
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("validationConfigurations")
|
||||
public void validation(String config,
|
||||
String value,
|
||||
Boolean expectedResult,
|
||||
ValidationMessage expectedError) {
|
||||
// setup
|
||||
Gson gson = new GsonBuilder().create();
|
||||
ValidationConfiguration validationConfiguration = gson.fromJson(config, ValidationConfiguration.class);
|
||||
Validator sut = new Validator(validationConfiguration, new TestColumnValueProvider());
|
||||
|
||||
// execution
|
||||
ValidationError result = sut.isValid(0, "column", value);
|
||||
@@ -87,45 +48,42 @@ public class ValidatorTest {
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// parameters for tests
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Parameterized.Parameters
|
||||
public static Collection validationConfigurations() {
|
||||
return asList(new Object[][] {
|
||||
{ constraintsJSON("string", "required", true), "value", true, null },
|
||||
{ constraintsJSON("string", "required", true), "", false, new ValidationMessage("validation.message.not.empty") },
|
||||
{ constraintsJSON("string", "required", true), null, false, new ValidationMessage("validation.message.not.empty") },
|
||||
{ constraintsJSON("integer", null, true), "999", true, null },
|
||||
{ constraintsJSON("integer", null, true), "a", false, new ValidationMessage("validation.message.integer") },
|
||||
{ constraintsJSON("number", null, true), "999", true, null },
|
||||
{ constraintsJSON("number", null, true), "999.000", true, null },
|
||||
{ constraintsJSON("number", null, true), "a", false, new ValidationMessage("validation.message.double") },
|
||||
{ constraintsJSON("string", "minLength", 2), "12", true, null },
|
||||
{ constraintsJSON("string", "minLength", 2), "1", false, new ValidationMessage("validation.message.min.length", "2") },
|
||||
{ constraintsJSON("string", "maxLength", 2), "12", true, null },
|
||||
{ constraintsJSON("string", "maxLength", 2), "123", false, new ValidationMessage("validation.message.max.length", "2") },
|
||||
{ constraintsJSON("string", "pattern", "[a-z]*"), "abc", true, null },
|
||||
{ constraintsJSON("string", "pattern", "[a-z]*"), "abcA", false, new ValidationMessage("validation.message.regexp", "[a-z]*") },
|
||||
{ constraintsJSON("string", "enum", asList("a","b","c","d","e")), "c", true, null },
|
||||
{ constraintsJSON("string", "enum", asList("a","b","c","d","e")), "f", false, new ValidationMessage("validation.message.value.of", "f", "a, b, c, d, e") },
|
||||
public static Stream<Arguments> validationConfigurations() {
|
||||
return Stream.of(
|
||||
Arguments.of( constraintsJSON("string", "required", true), "value", true, null ),
|
||||
Arguments.of( constraintsJSON("string", "required", true), "", false, new ValidationMessage("validation.message.not.empty") ),
|
||||
Arguments.of( constraintsJSON("string", "required", true), null, false, new ValidationMessage("validation.message.not.empty") ),
|
||||
Arguments.of( constraintsJSON("integer", null, true), "999", true, null ),
|
||||
Arguments.of( constraintsJSON("integer", null, true), "a", false, new ValidationMessage("validation.message.integer") ),
|
||||
Arguments.of( constraintsJSON("number", null, true), "999", true, null ),
|
||||
Arguments.of( constraintsJSON("number", null, true), "999.000", true, null ),
|
||||
Arguments.of( constraintsJSON("number", null, true), "a", false, new ValidationMessage("validation.message.double") ),
|
||||
Arguments.of( constraintsJSON("string", "minLength", 2), "12", true, null ),
|
||||
Arguments.of( constraintsJSON("string", "minLength", 2), "1", false, new ValidationMessage("validation.message.min.length", "2") ),
|
||||
Arguments.of( constraintsJSON("string", "maxLength", 2), "12", true, null ),
|
||||
Arguments.of( constraintsJSON("string", "maxLength", 2), "123", false, new ValidationMessage("validation.message.max.length", "2") ),
|
||||
Arguments.of( constraintsJSON("string", "pattern", "[a-z]*"), "abc", true, null ),
|
||||
Arguments.of( constraintsJSON("string", "pattern", "[a-z]*"), "abcA", false, new ValidationMessage("validation.message.regexp", "[a-z]*") ),
|
||||
Arguments.of( constraintsJSON("string", "enum", asList("a","b","c","d","e")), "c", true, null ),
|
||||
Arguments.of( constraintsJSON("string", "enum", asList("a","b","c","d","e")), "f", false, new ValidationMessage("validation.message.value.of", "f", "a, b, c, d, e") ),
|
||||
|
||||
{ formatJSON("string", null), "some string", true, null },
|
||||
{ formatJSON("string", "email"), "test@javafx.ninja", true, null },
|
||||
{ formatJSON("string", "email"), "wrong email", false, new ValidationMessage("validation.message.email") },
|
||||
{ formatJSON("string", "uri"), "http://www.javafx.ninja", true, null },
|
||||
{ formatJSON("string", "uri"), "!$%&/()", false, new ValidationMessage("validation.message.uri") },
|
||||
{ formatJSON("string", "binary"), "dGVzdA==", true, null },
|
||||
{ formatJSON("string", "binary"), "no binary", false, new ValidationMessage("validation.message.binary") },
|
||||
{ formatJSON("string", "uuid"), "6ba7b810-9dad-11d1-80b4-00c04fd430c8", true, null },
|
||||
{ formatJSON("string", "uuid"), "no uuid", false, new ValidationMessage("validation.message.uuid") },
|
||||
{ formatJSON("date", null), "2015-11-27", true, null },
|
||||
{ formatJSON("date", null), "27.11.2015", false, new ValidationMessage("validation.message.date.format", "yyyy-MM-dd") },
|
||||
{ formatJSON("date", "yyyyMMdd"), "20151127", true, null },
|
||||
{ formatJSON("date", "yyyyMMdd"), "27.11.2015", false, new ValidationMessage("validation.message.date.format", "yyyyMMdd") },
|
||||
Arguments.of( formatJSON("string", null), "some string", true, null ),
|
||||
Arguments.of( formatJSON("string", "email"), "test@javafx.ninja", true, null ),
|
||||
Arguments.of( formatJSON("string", "email"), "wrong email", false, new ValidationMessage("validation.message.email") ),
|
||||
Arguments.of( formatJSON("string", "uri"), "http://www.javafx.ninja", true, null ),
|
||||
Arguments.of( formatJSON("string", "uri"), "!$%&/()", false, new ValidationMessage("validation.message.uri") ),
|
||||
Arguments.of( formatJSON("string", "binary"), "dGVzdA==", true, null ),
|
||||
Arguments.of( formatJSON("string", "binary"), "no binary", false, new ValidationMessage("validation.message.binary") ),
|
||||
Arguments.of( formatJSON("string", "uuid"), "6ba7b810-9dad-11d1-80b4-00c04fd430c8", true, null ),
|
||||
Arguments.of( formatJSON("string", "uuid"), "no uuid", false, new ValidationMessage("validation.message.uuid") ),
|
||||
Arguments.of( formatJSON("date", null), "2015-11-27", true, null ),
|
||||
Arguments.of( formatJSON("date", null), "27.11.2015", false, new ValidationMessage("validation.message.date.format", "yyyy-MM-dd") ),
|
||||
Arguments.of( formatJSON("date", "yyyyMMdd"), "20151127", true, null ),
|
||||
Arguments.of( formatJSON("date", "yyyyMMdd"), "27.11.2015", false, new ValidationMessage("validation.message.date.format", "yyyyMMdd") ),
|
||||
|
||||
|
||||
{ customAttributeJSON( "groovy", "value.contains('a')? 'true' : 'no a inside'"), "abcdef", true, null },
|
||||
{ customAttributeJSON( "groovy", "value.contains('a')? 'true' : 'no a inside'"), "bcdefg", false, new ValidationMessage("no a inside") },
|
||||
|
||||
});
|
||||
Arguments.of( customAttributeJSON( "groovy", "value.contains('a')? 'true' : 'no a inside'"), "abcdef", true, null ),
|
||||
Arguments.of( customAttributeJSON( "groovy", "value.contains('a')? 'true' : 'no a inside'"), "bcdefg", false, new ValidationMessage("no a inside") )
|
||||
);
|
||||
}
|
||||
|
||||
public static String constraintsJSON(String type, String constraint, Object value) {
|
||||
|
||||
Reference in New Issue
Block a user