Changeset 9841 in josm for trunk/src/org


Ignore:
Timestamp:
2016-02-20T01:34:07+01:00 (8 years ago)
Author:
Don-vip
Message:

add unit test

Location:
trunk/src/org/openstreetmap/josm/gui/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java

    r9575 r9841  
    240240
    241241    public void setUploadStrategySpecification(UploadStrategySpecification strategy) {
    242         if (strategy == null) return;
     242        if (strategy == null)
     243            return;
    243244        rbStrategy.get(strategy.getStrategy()).setSelected(true);
    244245        tfChunkSize.setEnabled(strategy.getStrategy() == UploadStrategy.CHUNKED_DATASET_STRATEGY);
     
    256257        int chunkSize = getChunkSize();
    257258        UploadStrategySpecification spec = new UploadStrategySpecification();
    258         switch(strategy) {
    259         case INDIVIDUAL_OBJECTS_STRATEGY:
    260         case SINGLE_REQUEST_STRATEGY:
    261             spec.setStrategy(strategy);
    262             break;
    263         case CHUNKED_DATASET_STRATEGY:
    264             spec.setStrategy(strategy).setChunkSize(chunkSize);
    265             break;
     259        if (strategy != null) {
     260            switch(strategy) {
     261            case INDIVIDUAL_OBJECTS_STRATEGY:
     262            case SINGLE_REQUEST_STRATEGY:
     263                spec.setStrategy(strategy);
     264                break;
     265            case CHUNKED_DATASET_STRATEGY:
     266                spec.setStrategy(strategy).setChunkSize(chunkSize);
     267                break;
     268            }
    266269        }
    267270        if (pnlMultiChangesetPolicyPanel.isVisible()) {
  • trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySpecification.java

    r9371 r9841  
    3535
    3636    /**
    37      * Clones another upload strategy. If other is null,assumes default
    38      * values.
     37     * Clones another upload strategy. If other is null, assumes default values.
    3938     *
    4039     * @param other the other upload strategy
    4140     */
    4241    public UploadStrategySpecification(UploadStrategySpecification other) {
    43         if (other == null) return;
    44         this.strategy = other.strategy;
    45         this.chunkSize = other.chunkSize;
    46         this.policy = other.policy;
    47         this.closeChangesetAfterUpload = other.closeChangesetAfterUpload;
     42        if (other != null) {
     43            this.strategy = other.strategy;
     44            this.chunkSize = other.chunkSize;
     45            this.policy = other.policy;
     46            this.closeChangesetAfterUpload = other.closeChangesetAfterUpload;
     47        }
    4848    }
    4949
     
    9393
    9494    public int getNumRequests(int numObjects) {
    95         if (numObjects <= 0) return 0;
     95        if (numObjects <= 0)
     96            return 0;
    9697        switch(strategy) {
    9798        case INDIVIDUAL_OBJECTS_STRATEGY: return numObjects;
     
    114115    @Override
    115116    public boolean equals(Object obj) {
    116         if (this == obj) return true;
    117         if (obj == null || getClass() != obj.getClass()) return false;
     117        if (this == obj)
     118            return true;
     119        if (obj == null || getClass() != obj.getClass())
     120            return false;
    118121        UploadStrategySpecification that = (UploadStrategySpecification) obj;
    119122        return chunkSize == that.chunkSize &&
Note: See TracChangeset for help on using the changeset viewer.