if (menuElement.getName().equals(MenuXMLDecoder.MENU)) { String menuId = menuElement .getAttributeValue(MenuXMLDecoder.ID); String menuName = mediator.getString("menu", "mainframe", menuId); ExtendableMenu menu = new ExtendableMenu(menuId, menuName); parseMenu(menu, menuElement); menuBar.add(menu); }
Object uid = addMessage(); getSourceFolder().setAttribute(uid, "columba.spam", Boolean.TRUE); // create filter configuration MailFilterCriteria criteria = MailFilterFactory.createSpamMessages(); // create filter FlagsFilter filter = new FlagsFilter(); // init configuration filter.setUp(criteria); // execute filter boolean result = filter.process(getSourceFolder(), uid); assertEquals("filter result", true, result);
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/menu/MenuXMLDecoder.java File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/filter/plugins/FlagsFilterTest.java
Method name: ExtendableMenuBar createMenuBar(InputStream) Method name: void testIsSpam()
Number of AST nodes: 6 Number of AST nodes: 7
1
if (menuElement.getName().equals(MenuXMLDecoder.MENU)) {
2
				String menuId = menuElement
3
						.getAttributeValue(MenuXMLDecoder.ID);
4
				String menuName = mediator.getString("menu", "mainframe",
5
						menuId);
6
				ExtendableMenu menu = new ExtendableMenu(menuId, menuName);
7
				parseMenu(menu, menuElement);
8
				menuBar.add(menu);
9
			}
1
Object uid = addMessage();
2
       
3
        getSourceFolder().setAttribute(uid, "columba.spam", Boolean.TRUE);
4
        
5
        // create filter configuration
6
       MailFilterCriteria criteria = MailFilterFactory.createSpamMessages();
7
        
8
        // create filter
9
        FlagsFilter filter = new FlagsFilter();
10
        // init configuration
11
        filter.setUp(criteria);
12
        // execute filter
13
        boolean result = filter.process(getSourceFolder(), uid);
14
        assertEquals("filter result", true, result);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in different classes
Number of node comparisons35
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment6
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                          
    1
    Object uid = addMessage();
                                                                                                                                          
    2
    getSourceFolder().setAttribute(uid, "columba.spam", Boolean.TRUE);
                                                                                                                                                
    3
    MailFilterCriteria criteria = MailFilterFactory.createSpamMessages();
                                                                                    
    4
    FlagsFilter filter = new FlagsFilter();
                                                        
    5
    filter.setUp(criteria);
    Preondition Violations
    Unmatched statement filter.setUp(criteria); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    filter.setUp(criteria);
                                                                                                                    
    6
    boolean result = filter.process(getSourceFolder(), uid);
    11
    String menuId = menuElement.getAttributeValue(MenuXMLDecoder.ID);
                                                                                                                                          
    12
    String menuName = mediator.getString("menu", "mainframe", menuId);
    12
    String menuName = mediator.getString("menu", "mainframe", menuId);
    Preondition Violations
    Unmatched statement String menuName=mediator.getString("menu","mainframe",menuId); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                        
    13
    ExtendableMenu menu = new ExtendableMenu(menuId, menuName);
    13
    ExtendableMenu menu = new ExtendableMenu(menuId, menuName);
    Preondition Violations
    Unmatched statement ExtendableMenu menu=new ExtendableMenu(menuId,menuName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                            
    14
    parseMenu(menu, menuElement);
    14
    parseMenu(menu, menuElement);
    7
    assertEquals("filter result", true, result);
    Differences
    Expression1Expression2Difference
    parseMenuassertEqualsMETHOD_INVOCATION_NAME_MISMATCH
    parseMenu(menu,menuElement)assertEquals("filter result",true,result)TYPE_COMPATIBLE_REPLACEMENT
    parseMenu(menu,menuElement)assertEquals("filter result",true,result)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression parseMenu(menu,menuElement) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method parseMenu
    Expression assertEquals("filter result",true,result) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression parseMenu(menu,menuElement) is a void method call, and thus it cannot be parameterized
    Expression assertEquals("filter result",true,result) is a void method call, and thus it cannot be parameterized
    Expression parseMenu(menu,menuElement) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method parseMenu
    Expression assertEquals("filter result",true,result) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression parseMenu(menu,menuElement) is a void method call, and thus it cannot be parameterized
    Expression assertEquals("filter result",true,result) is a void method call, and thus it cannot be parameterized
    7
    assertEquals("filter result", true, result);
    15
    menuBar.add(menu);
    15
    menuBar.add(menu);
    Preondition Violations
    Unmatched statement menuBar.add(menu); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                
    Precondition Violations (13)
    Row Violation
    1Unmatched statement filter.setUp(criteria); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement String menuName=mediator.getString("menu","mainframe",menuId); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement ExtendableMenu menu=new ExtendableMenu(menuId,menuName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Expression parseMenu(menu,menuElement) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression assertEquals("filter result",true,result) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression parseMenu(menu,menuElement) is a void method call, and thus it cannot be parameterized
    7Expression assertEquals("filter result",true,result) is a void method call, and thus it cannot be parameterized
    8Expression parseMenu(menu,menuElement) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression assertEquals("filter result",true,result) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression parseMenu(menu,menuElement) is a void method call, and thus it cannot be parameterized
    11Expression assertEquals("filter result",true,result) is a void method call, and thus it cannot be parameterized
    12Unmatched statement menuBar.add(menu); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13The refactoring of the clones is infeasible, because classes org.columba.core.gui.menu.MenuXMLDecoder and org.columba.mail.filter.plugins.FlagsFilterTest do not have a common superclass