From d3d183f40cb54ff124a6b27895a44d413bf20c60 Mon Sep 17 00:00:00 2001 From: Matthieu Vergne Date: Wed, 24 Oct 2018 20:14:32 +0200 Subject: [PATCH] Add test for abstract methods (abstract class & interface). --- .../gr/gousiosg/javacg/abstract.feature | 24 +++++++++++++++++++ .../gr/gousiosg/javacg/interface.feature | 24 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/test/resources/gr/gousiosg/javacg/abstract.feature create mode 100644 src/test/resources/gr/gousiosg/javacg/interface.feature diff --git a/src/test/resources/gr/gousiosg/javacg/abstract.feature b/src/test/resources/gr/gousiosg/javacg/abstract.feature new file mode 100644 index 00000000..f5a14436 --- /dev/null +++ b/src/test/resources/gr/gousiosg/javacg/abstract.feature @@ -0,0 +1,24 @@ +#Author: matthieu.vergne@gmail.com +Feature: Abstract + I want to identify all abstract methods within the analyzed code. + + Scenario: Retrieve abstract method call + Given I have the class "MyAbstract" with code: + """ + public abstract class MyAbstract { + public abstract void doSomething(); + } + """ + Given I have the class "AbstractTest" with code: + """ + public class AbstractTest { + public void execute(MyAbstract x) { + x.doSomething(); + } + } + """ + When I run the analyze + Then the result should contain: + """ + M:AbstractTest:execute(MyAbstract) (M)MyAbstract:doSomething() + """ \ No newline at end of file diff --git a/src/test/resources/gr/gousiosg/javacg/interface.feature b/src/test/resources/gr/gousiosg/javacg/interface.feature new file mode 100644 index 00000000..738c7315 --- /dev/null +++ b/src/test/resources/gr/gousiosg/javacg/interface.feature @@ -0,0 +1,24 @@ +#Author: matthieu.vergne@gmail.com +Feature: Interface + I want to identify all interface methods within the analyzed code. + + Scenario: Retrieve interface method call + Given I have the class "MyInterface" with code: + """ + public interface MyInterface { + public void doSomething(); + } + """ + Given I have the class "InterfaceTest" with code: + """ + public class InterfaceTest { + public void execute(MyInterface x) { + x.doSomething(); + } + } + """ + When I run the analyze + Then the result should contain: + """ + M:InterfaceTest:execute(MyInterface) (I)MyInterface:doSomething() + """ \ No newline at end of file