File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/category/junit/StatisticalBarRendererTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/category/junit/StatisticalLineAndShapeRendererTests.java | |||
Method name: void testDrawWithNullDeviationHorizontal()
|
Method name: void testDrawWithNullInfo()
|
|||
Number of AST nodes: 9 | Number of AST nodes: 10 | |||
1 | boolean success = false;↵ | |||
1 | try {↵ | 2 | try {↵ | |
2 | DefaultStatisticalCategoryDataset dataset↵ | 3 | DefaultStatisticalCategoryDataset dataset↵ | |
3 | = new DefaultStatisticalCategoryDataset();↵ | 4 | = new DefaultStatisticalCategoryDataset();↵ | |
4 | dataset.add(1.0, 2.0, "S1", "C1");↵ | 5 | dataset.add(1.0, 2.0, "S1", "C1");↵ | |
5 | dataset.add(new Double(4.0), null, "S1", "C2");↵ | 6 | dataset.add(3.0, 4.0, "S1", "C2");↵ | |
6 | CategoryPlot plot = new CategoryPlot(dataset,↵ | 7 | CategoryPlot plot = new CategoryPlot(dataset,↵ | |
7 | new CategoryAxis("Category"), new NumberAxis("Value"),↵ | 8 | new CategoryAxis("Category"), new NumberAxis("Value"),↵ | |
8 | new StatisticalBarRenderer());↵ | 9 | new StatisticalLineAndShapeRenderer());↵ | |
9 | plot.setOrientation(PlotOrientation.HORIZONTAL);↵ | |||
10 | JFreeChart chart = new JFreeChart(plot);↵ | 10 | JFreeChart chart = new JFreeChart(plot);↵ | |
11 | /* BufferedImage image = */ chart.createBufferedImage(300, 200,↵ | 11 | /* BufferedImage image = */ chart.createBufferedImage(300, 200,↵ | |
12 | null);↵ | 12 | null);↵ | |
13 | success = true;↵ | 13 | success = true;↵ | |
14 | }↵ | 14 | }↵ | |
15 | catch (NullPointerException e) {↵ | 15 | catch (NullPointerException e) {↵ | |
16 | e.printStackTrace();↵ | 16 | e.printStackTrace();↵ | |
17 | success = false;↵ | 17 | success = false;↵ | |
18 | } | 18 | }↵ | |
19 |
| |||
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 72 |
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 102.7 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | boolean success = false; | ||||||||||||||||||||||||||||||||
2 | try | 2 | try | |||||||||||||||||||||||||||||||
3 | DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset(); | 3 | DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset(); | |||||||||||||||||||||||||||||||
4 | dataset.add(1.0, 2.0, "S1", "C1"); | 4 | dataset.add(1.0, 2.0, "S1", "C1"); | |||||||||||||||||||||||||||||||
5 | dataset.add(new Double(4.0), null, "S1", "C2"); |
| | |||||||||||||||||||||||||||||||
6 | CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new StatisticalBarRenderer()); |
| 6 | CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new StatisticalLineAndShapeRenderer()); | ||||||||||||||||||||||||||||||
7 | plot.setOrientation(PlotOrientation.HORIZONTAL); |
| 5 | dataset.add(3.0, 4.0, "S1", "C2"); | ||||||||||||||||||||||||||||||
8 | JFreeChart chart = new JFreeChart(plot); | 7 | JFreeChart chart = new JFreeChart(plot); | |||||||||||||||||||||||||||||||
9 | chart.createBufferedImage(300, 200, null); | 8 | chart.createBufferedImage(300, 200, null); | |||||||||||||||||||||||||||||||
10 | success = true; | 9 | success = true; | |||||||||||||||||||||||||||||||
|
| 10 | assertTrue(success); |
Row | Violation |
---|---|
1 | Unmatched statement dataset.add(new Double(4.0),null,"S1","C2"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement dataset.add(new Double(4.0),null,"S1","C2"); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
3 | Expression plot.setOrientation(PlotOrientation.HORIZONTAL) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression dataset.add(3.0,4.0,"S1","C2") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression plot.setOrientation(PlotOrientation.HORIZONTAL) is a void method call, and thus it cannot be parameterized |
6 | Expression dataset.add(3.0,4.0,"S1","C2") is a void method call, and thus it cannot be parameterized |
7 | Expression plot cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression dataset cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression plot cannot be unified with expression dataset , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void setOrientation(org.jfree.chart.plot.PlotOrientation) , public void add(double, double, Comparable#RAW, Comparable#RAW) |
10 | Expression plot.setOrientation(PlotOrientation.HORIZONTAL) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression dataset.add(3.0,4.0,"S1","C2") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Expression plot.setOrientation(PlotOrientation.HORIZONTAL) is a void method call, and thus it cannot be parameterized |
13 | Expression dataset.add(3.0,4.0,"S1","C2") is a void method call, and thus it cannot be parameterized |
14 | Unmatched statement assertTrue(success); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
15 | Clone fragment #1 returns variables success , while Clone fragment #2 returns variables |