I have a query about some homework I'm doing.

I've just started an intermediate java class and we're covering design patterns. I've found my self banging my head against a wall with the chain of responsibility pattern, everything else I seem to have nailed.

The scenario
There is a spaceship with 4 crew members, each member can handle a certain type of malfunction on the ship.

SpaceMonkey - can handle TRIVIAL malfunctions
ServiceRobot - can handle LOW/TRIVIAL malfunctions
Engineer - can handle MEDIUM/LOW/TRIVIAL malfunctions
Captain - can handle HIGH/ALL malfunctions

Class structure
(Abstract) MalfunctionHandler
(Enum) Severity
(Extends MalfunctionHandler) SpaceMonkey, ServiceRobot, Engineer & Captain

The problem I am having is that the Captain could be given a LOW malfunction, which he can handle.
I have a method called processMalfunction (as part of MalfunctionHandler), which takes an object of type Malfunction (a Malfunction object takes an enum which is the severity and a string which is a description of the issue).

The malfunction is then compared with the crew member who has been handed the malfunction and is in this instance if it was a Captain taking a LOW priority malfunction he would be able to handle it.

I can do the if statement to compare if the current malfunction enum matches the enum of the severity of the crew member, but I need some way of comparing it against the other levels that are below his severity level in case he has been handed a lower level task.

Here's a snippet of the processMalfunction method:
final protecte void processMalfunction(Malfunction m) {
    if (severity.getSeverityValue() >= m.getSeverity().getSeverityValue()) {
    } else {

and a copy of the Malfunction class:
public class Malfunction {
    private Severity severity;
    private String description;
     * @param severity
     * @param description 
    public Malfunction(Severity s, String d) {
        if (d == null || d.isEmpty()) {
            this.description = "No description available. Probably serious.";
        } else {
            this.severity = s;
            this.description = d;

     * @return severity
    public Severity getSeverity() {
        return severity;
     * @return description
    public String getDescription() {
        return description;
Can anyone suggest the best way for me to compare the enum type of the crew member against the malfunction enum passed in right from the crew memebers severityvalue down the lowest?
i.e. If it was an engineer getting passed getting passed a LOW malfunction, I would need to check against the enum MEDIUM, LOW & TRIVIAL to ensure that he can process the malfunction as in the if statement if he can process it, he will. So essentially I need this:
If the malfunction level is equal or less than the enum severity level of the crew member, handle it, if not, pass it on.

Any help would be greatly appreciated
Kind Regards,

Here's a copy of the NetBeans project (ver 7.3.1 if it matterss) if anyone would like to take a look. There are some unit tests in there that must pass, but no matter how much I think, I just keep hitting blanks. Link to project:

or, if you'd rather not have to download the project, here's a snippet of the unit tests:
public class MalfunctionHandlerTest {
     * No-args constructor.
    public MalfunctionHandlerTest() {

     * Test of processMalfunction method, of class MalfunctionHandler.
    public void testProcessMalfunction() {
        // Instanciate malfunction handlers
        final SpaceMonkey sm = new SpaceMonkey(Severity.TRIVIAL);
        final ServiceRobot sr = new ServiceRobot(Severity.LOW);
        final Engineer e = new Engineer(Severity.MEDIUM);
        final Captain c = new Captain(Severity.HIGH);
        // Use trickle down technique to build chain
        // Create malfunctions
        final Malfunction m1 = new Malfunction(Severity.HIGH, "Life support error. Oxygen "
                 + "Recycling unit damaged, running at half efficiency");      
        final Malfunction m2  = new Malfunction(Severity.LOW, "Communications error. Cannot "
                + "find Jazz FM");
        final Malfunction m3 = new Malfunction(Severity.MEDIUM, "Power supply error. Solar Panel "
                + "2 damaged, running at 31.3333% efficiency");
        final Malfunction m4 = new Malfunction(Severity.MEDIUM, "Thermal regulation error. Sensor "
                + "damaged, manual temperature regulation needed");
        final Malfunction m5 = new Malfunction(Severity.TRIVIAL, "Trash can full on C-Desk.");
        final Malfunction m6 = new Malfunction(Severity.LOW, "Shower plug hole full of monkey hair");
        final Malfunction m7 = new Malfunction(Severity.HIGH, "Proximity alert. Collision imminent");
        // Clean log file
        FileUtility.resetFile(new File("log-cor2.txt"));
        // Process malfunctions
        // Check  log file
        final String actualOutput = FileUtility.readFile(new File("log-cor2.txt"));
        final String expectedOutput = FileUtility.readFile(new File("expected-cor2.txt"));
        assertEquals(actualOutput, expectedOutput);