<?xml version="1.0" encoding="UTF-8"?>
<test-data>
    <test-code>
        <description><![CDATA[
call super
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
  public void foo() {
    super.foo();
  }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
call super with same argument
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
  public void foo(String bar) {
    super.foo(bar);
  }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
call super with different argument
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
  String text = "text";
  public void foo(String bar) {
     super.foo(text);
  }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
call super with different argument 2
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
  public void foo(String bar) {
    super.foo(boe(bar));
  }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
call super with different argument 3
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Buz{
  public String foo(String bar) {
    super.foo("" + bar);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
call super with inverted arguments
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
  public void foo(String bar, String stool) {
    super.foo(stool, bar);
  }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
return value of super
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
  public String foo() {
    return super.foo();
  }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
return value of super with argument
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
  public String foo(String bar) {
    return super.foo(bar);
  }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
return value of super after adding a string
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
  public String foo(String bar) {
    return super.foo(bar) + "is foo";
  }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
do not crash on abstract methods
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
  public abstract String foo();
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
do not crash on interfaces
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public interface Foo extends Bar {
  public String foo();
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
do not crash on empty returns
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
  public void foo(String bar) {
    return;
  }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
do not crash on super
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
  public void init(String[] args) {
    super.init( args, Application.NO_MODULES );
  }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
call super with different argument 4
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Buz{
  public String foo(Object bar) {
    super.foo(this);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
adding final is OK
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
   public final String foo() {
      return super.foo();
   }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
adding synchronized is OK
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
   public synchronized String foo() {
     return super.foo();
   }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
Constructors are OK
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
   public Foo(String bar) {
     super(bar);
   }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
Should ignore clone implementation ( see bug 1522517)
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
   public Object clone() throws CloneNotSupportedException {
	 return super.clone();
   }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
clone method with arguments should not be ignored
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo extends Bar {
   public Object clone(Object o) throws CloneNotSupportedException {
	  return super.clone(o);
   }
}
     ]]></code>
    </test-code>
    <test-code regressionTest="false">
        <description>
        	<![CDATA[
False +: Overriding method merely calls super (see bug 1415525)
     		]]>
     	</description>
        <expected-problems>0</expected-problems>
        <code>
        	<![CDATA[
import nu.xom.Serializer;

private static class ExposingSerializer extends Serializer {

	ExposingSerializer(OutputStream out, String encoding)
	throws UnsupportedEncodingException {
		super(out, encoding);
	}

  /**
   * Overriding in order to change the access modifier from
   * protected to public - so: not only merely calling super.
   *
   * Method signature in super class:
   * protected void writeChild(nu.xom.Node arg0) throws java.io.IOException;
   *
   * See: https://sourceforge.net/tracker/?func=detail&aid=1415525&group_id=56262&atid=479921
   */
	public void writeChild(Node node) throws IOException {
	    super.writeChild(node);
	}

	public void exposedWriteRaw(String text) throws IOException {
		writeRaw(text);
	}

	public void exposedWriteEscaped(String text) throws IOException {
		writeEscaped(text);
	}

	public void exposedWriteAttributeValue(String text) throws IOException {
		writeAttributeValue(text);
	}
}
     ]]></code>
    </test-code>
    <test-code>
        <description>
        	<![CDATA[
[ 1977230 ] false positive: UselessOverridingMethod
     		]]>
     	</description>
        <expected-problems>0</expected-problems>
        <code>
        	<![CDATA[
public class Foo extends Bar {

	public BigDecimal getBalance(Date date) {
		return super.getBalance(date).negate();
	}
}

class Bar {
	public BigDecimal getBalance(Date date) {
	}
}
     ]]></code>
    </test-code>
    <test-code reinitializeRule="1">
        <description>
        	<![CDATA[
[ 2142986 ] UselessOverridingMethod doesn't consider annotations, ignoreAnnotations property set to true
     		]]>
     	</description>
        <rule-property name="ignoreAnnotations">true</rule-property>
        <expected-problems>1</expected-problems>
        <code>
        	<![CDATA[
class PersistentObject {
  public Long getId() { return 1L; } 
}

public class Example extends PersistentObject {
  @Override
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  public Long getId() { return super.getId(); }
}
     ]]></code>
    </test-code>
    <test-code reinitializeRule="1">
        <description>
        	<![CDATA[
[ 2142986 ] UselessOverridingMethod doesn't consider annotations
     		]]>
     	</description>
        <expected-problems>0</expected-problems>
        <code>
        	<![CDATA[
class PersistentObject {
  public Long getId() { return 1L; } 
}

public class Example extends PersistentObject {
  @Override
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  public Long getId() { return super.getId(); }
}
     ]]></code>
    </test-code>
    <test-code reinitializeRule="1">
        <description>
        	<![CDATA[
[ 2142986 ] UselessOverridingMethod doesn't consider annotations, @Override only
     		]]>
     	</description>
        <expected-problems>1</expected-problems>
        <code>
        	<![CDATA[
class PersistentObject {
  public Long getId() { return 1L; } 
}

public class Example extends PersistentObject {
  @Override
  public Long getId() { return super.getId(); }
}
     ]]></code>
    </test-code>

</test-data>
