EMMA Coverage Report (generated Thu May 22 12:08:10 CDT 2014)
[all classes][org.springframework.batch.core.step.tasklet]

COVERAGE SUMMARY FOR SOURCE FILE [ConfigurableSystemProcessExitCodeMapper.java]

nameclass, %method, %block, %line, %
ConfigurableSystemProcessExitCodeMapper.java100% (1/1)100% (3/3)100% (28/28)100% (8/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ConfigurableSystemProcessExitCodeMapper100% (1/1)100% (3/3)100% (28/28)100% (8/8)
ConfigurableSystemProcessExitCodeMapper (): void 100% (1/1)100% (3/3)100% (1/1)
getExitStatus (int): ExitStatus 100% (1/1)100% (17/17)100% (4/4)
setMappings (Map): void 100% (1/1)100% (8/8)100% (3/3)

1/*
2 * Copyright 2006-2013 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 
17package org.springframework.batch.core.step.tasklet;
18 
19import java.util.Map;
20 
21import org.springframework.batch.core.ExitStatus;
22import org.springframework.util.Assert;
23 
24/**
25 * Maps exit codes to {@link org.springframework.batch.core.ExitStatus}
26 * according to injected map. The injected map is required to contain a value
27 * for 'else' key, this value will be returned if the injected map
28 * does not contain value for the exit code returned by the system process.
29 *
30 * @author Robert Kasanicky
31 */
32public class ConfigurableSystemProcessExitCodeMapper implements SystemProcessExitCodeMapper {
33 
34        public static final String ELSE_KEY = "else";
35 
36        private Map<Object, ExitStatus> mappings;
37 
38    @Override
39        public ExitStatus getExitStatus(int exitCode) {
40                ExitStatus exitStatus = mappings.get(exitCode);
41                if (exitStatus != null) {
42                        return exitStatus;
43                } else {
44                        return mappings.get(ELSE_KEY);
45                }
46        }
47 
48        /**
49         * @param mappings <code>Integer</code> exit code keys to
50         * {@link org.springframework.batch.core.ExitStatus} values.
51         */
52        public void setMappings(Map<Object, ExitStatus> mappings) {
53                Assert.notNull(mappings.get(ELSE_KEY));
54                this.mappings = mappings;
55        }
56 
57}

[all classes][org.springframework.batch.core.step.tasklet]
EMMA 2.0.5312 (C) Vladimir Roubtsov