diff --git a/resources/testdata/src_changetypes/MethodRenaming_Left.java b/resources/testdata/src_changetypes/MethodRenaming_Left.java new file mode 100644 index 0000000..64d683a --- /dev/null +++ b/resources/testdata/src_changetypes/MethodRenaming_Left.java @@ -0,0 +1,8 @@ +package test; +public class Test { + + public void MethodtoChangeName(){ + + } + +} diff --git a/resources/testdata/src_changetypes/MethodRenaming_Right.java b/resources/testdata/src_changetypes/MethodRenaming_Right.java new file mode 100644 index 0000000..31e29cb --- /dev/null +++ b/resources/testdata/src_changetypes/MethodRenaming_Right.java @@ -0,0 +1,8 @@ +package test; +public class Test { + + public void MethodNameChanged(){ + + } + +} diff --git a/resources/testdata/src_changetypes/RemovingClassDerivability_Left.java b/resources/testdata/src_changetypes/RemovingClassDerivability_Left.java new file mode 100644 index 0000000..68d0951 --- /dev/null +++ b/resources/testdata/src_changetypes/RemovingClassDerivability_Left.java @@ -0,0 +1,8 @@ +package test; +public class Test { + + public void DerivableClassCh(){ //this class is derivable + + } + +} diff --git a/resources/testdata/src_changetypes/RemovingClassDerivability_Right.java b/resources/testdata/src_changetypes/RemovingClassDerivability_Right.java new file mode 100644 index 0000000..9d45906 --- /dev/null +++ b/resources/testdata/src_changetypes/RemovingClassDerivability_Right.java @@ -0,0 +1,8 @@ +package test; +public final class Test { //final makes it imossible to be extended by a subclass + + public void DerivableClassCh(){ //this class isn't derivable + + } + +} diff --git a/resources/testdata/src_changetypes/RemovingMethodOverridability_Left.java b/resources/testdata/src_changetypes/RemovingMethodOverridability_Left.java new file mode 100644 index 0000000..01b1e5b --- /dev/null +++ b/resources/testdata/src_changetypes/RemovingMethodOverridability_Left.java @@ -0,0 +1,8 @@ +package test; +public class Test { + + public void OverridableMethodCh(){ //This method is overridable + + } + +} diff --git a/resources/testdata/src_changetypes/RemovingMethodOverridability_Right.java b/resources/testdata/src_changetypes/RemovingMethodOverridability_Right.java new file mode 100644 index 0000000..88923c0 --- /dev/null +++ b/resources/testdata/src_changetypes/RemovingMethodOverridability_Right.java @@ -0,0 +1,8 @@ +package test; +public class Test { + + public static void OverridableMethodCh(){ //Making method static disables its overridability + + } + +} diff --git a/src/test/java/ch/uzh/ifi/seal/changedistiller/unittest/MethodRenamingTest.java b/src/test/java/ch/uzh/ifi/seal/changedistiller/unittest/MethodRenamingTest.java new file mode 100644 index 0000000..11ebf0c --- /dev/null +++ b/src/test/java/ch/uzh/ifi/seal/changedistiller/unittest/MethodRenamingTest.java @@ -0,0 +1,51 @@ +package ch.uzh.ifi.seal.changedistiller.unittest; + +/* + * #%L + * ChangeDistiller + * %% + * Copyright (C) 2011 - 2018 Software Architecture and Evolution Lab, Department of Informatics, UZH + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +import ch.uzh.ifi.seal.changedistiller.model.entities.SourceCodeChange; + +public class MethodRenamingTest { + List sourceCodeChangeList; + + @Before + public void setUp() { + sourceCodeChangeList = FileDistillerUtil.getChangesFromFile("MethodRenaming_Left.java", "MethodRenaming_Right.java"); + } + + @Test + public void methodRenamingTest() { + String expected = "METHOD_RENAMING\n"; + + StringBuilder stringBuilder = new StringBuilder(); + for(SourceCodeChange change : sourceCodeChangeList) { + stringBuilder.append(change.getLabel() + "\n"); + } + + assertEquals(stringBuilder.toString(), expected); + } +} diff --git a/src/test/java/ch/uzh/ifi/seal/changedistiller/unittest/RemovingClassDerivabilityTest.java b/src/test/java/ch/uzh/ifi/seal/changedistiller/unittest/RemovingClassDerivabilityTest.java new file mode 100644 index 0000000..0e733b3 --- /dev/null +++ b/src/test/java/ch/uzh/ifi/seal/changedistiller/unittest/RemovingClassDerivabilityTest.java @@ -0,0 +1,51 @@ +package ch.uzh.ifi.seal.changedistiller.unittest; + +/* + * #%L + * ChangeDistiller + * %% + * Copyright (C) 2011 - 2018 Software Architecture and Evolution Lab, Department of Informatics, UZH + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +import ch.uzh.ifi.seal.changedistiller.model.entities.SourceCodeChange; + +public class RemovingClassDerivabilityTest { + List sourceCodeChangeList; + + @Before + public void setUp() { + sourceCodeChangeList = FileDistillerUtil.getChangesFromFile("RemovingClassDerivability_Left.java", "RemovingClassDerivability_Right.java"); + } + + @Test + public void removingClassDerivabilityTest() { + String expected = "REMOVING_CLASS_DERIVABILITY\n"; + + StringBuilder stringBuilder = new StringBuilder(); + for(SourceCodeChange change : sourceCodeChangeList) { + stringBuilder.append(change.getLabel() + "\n"); + } + + assertEquals(stringBuilder.toString(), expected); + } +} diff --git a/src/test/java/ch/uzh/ifi/seal/changedistiller/unittest/RemovingMethodOverridabilityTest.java b/src/test/java/ch/uzh/ifi/seal/changedistiller/unittest/RemovingMethodOverridabilityTest.java new file mode 100644 index 0000000..f9f7dbe --- /dev/null +++ b/src/test/java/ch/uzh/ifi/seal/changedistiller/unittest/RemovingMethodOverridabilityTest.java @@ -0,0 +1,51 @@ +package ch.uzh.ifi.seal.changedistiller.unittest; + +/* + * #%L + * ChangeDistiller + * %% + * Copyright (C) 2011 - 2018 Software Architecture and Evolution Lab, Department of Informatics, UZH + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +import ch.uzh.ifi.seal.changedistiller.model.entities.SourceCodeChange; + +public class RemovingMethodOverridabilityTest { + List sourceCodeChangeList; + + @Before + public void setUp() { + sourceCodeChangeList = FileDistillerUtil.getChangesFromFile("RemovingMethodOverridability_Left.java", "RemovingMethodOverridability_Right.java"); + } + + @Test + public void removingMethodOverridabilityTest() { + String expected = "REMOVING_METHOD_OVERRIDABILITY\n"; + + StringBuilder stringBuilder = new StringBuilder(); + for(SourceCodeChange change : sourceCodeChangeList) { + stringBuilder.append(change.getLabel() + "\n"); + } + + assertEquals(stringBuilder.toString(), expected); + } +}