|
| 1 | +/* |
| 2 | + * This file is part of GumTree. |
| 3 | + * |
| 4 | + * GumTree is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU Lesser General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * GumTree is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU Lesser General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU Lesser General Public License |
| 15 | + * along with GumTree. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + * |
| 17 | + * Copyright 2011-2015 Jean-Rémy Falleri <[email protected]> |
| 18 | + * Copyright 2011-2015 Floréal Morandat <[email protected]> |
| 19 | + */ |
| 20 | + |
| 21 | +package com.github.gumtreediff.gen.jdt; |
| 22 | + |
| 23 | +import com.github.gumtreediff.actions.ActionGenerator; |
| 24 | +import com.github.gumtreediff.actions.model.Action; |
| 25 | +import com.github.gumtreediff.matchers.Matcher; |
| 26 | +import com.github.gumtreediff.matchers.Matchers; |
| 27 | +import com.github.gumtreediff.tree.ITree; |
| 28 | +import com.github.gumtreediff.tree.TreeContext; |
| 29 | +import org.junit.Test; |
| 30 | + |
| 31 | +import java.io.IOException; |
| 32 | +import java.util.List; |
| 33 | + |
| 34 | +import static org.junit.Assert.assertEquals; |
| 35 | + |
| 36 | +public class TestIssue98 { |
| 37 | + |
| 38 | + @Test |
| 39 | + public void shouldHaveDifferentTree() throws IOException { |
| 40 | + String left = "public interface Main { }"; |
| 41 | + String right = "public class Main { }"; |
| 42 | + |
| 43 | + ITree leftTree = new JdtTreeGenerator().generateFromString(left).getRoot(); |
| 44 | + ITree rightTree = new JdtTreeGenerator().generateFromString(right).getRoot(); |
| 45 | + Matcher m = Matchers.getInstance().getMatcher(leftTree, rightTree); |
| 46 | + m.match(); |
| 47 | + |
| 48 | + ActionGenerator g = new ActionGenerator(leftTree, rightTree, m.getMappings()); |
| 49 | + List<Action> actions = g.generate(); |
| 50 | + |
| 51 | + assertEquals(1, actions.size()); |
| 52 | + } |
| 53 | + |
| 54 | +} |
0 commit comments