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 comparisons27
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment5
    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();
                                                                                                                    
    6
    boolean result = filter.process(getSourceFolder(), uid);
    Preondition Violations
    Unmatched statement boolean result=filter.process(getSourceFolder(),uid); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    boolean result = filter.process(getSourceFolder(), uid);
    11
    String menuId = menuElement.getAttributeValue(MenuXMLDecoder.ID);
                                                                                                                                          
    12
    String menuName = mediator.getString("menu", "mainframe", menuId);
                                                                                                                                        
    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);
    5
    filter.setUp(criteria);
    Differences
    Expression1Expression2Difference
    parseMenusetUpMETHOD_INVOCATION_NAME_MISMATCH
    parseMenu(menu,menuElement)filter.setUp(criteria)ARGUMENT_NUMBER_MISMATCH
    filterMISSING_METHOD_INVOCATION_EXPRESSION
    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 parseMenu(menu,menuElement) is a void method call, and thus it cannot be parameterized
    Expression filter.setUp(criteria) 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 parseMenu(menu,menuElement) is a void method call, and thus it cannot be parameterized
    Expression filter.setUp(criteria) is a void method call, and thus it cannot be parameterized
    5
    filter.setUp(criteria);
    15
    menuBar.add(menu);
    15
    menuBar.add(menu);
    7
    assertEquals("filter result", true, result);
    Differences
    Expression1Expression2Difference
    addassertEqualsMETHOD_INVOCATION_NAME_MISMATCH
    menuBar.add(menu)assertEquals("filter result",true,result)ARGUMENT_NUMBER_MISMATCH
    menuBarMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression menuBar.add(menu) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression menuBar.add(menu) 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 menuBar.add(menu) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression menuBar.add(menu) 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);
    Precondition Violations (14)
    Row Violation
    1Unmatched statement boolean result=filter.process(getSourceFolder(),uid); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched 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
    3Expression parseMenu(menu,menuElement) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression parseMenu(menu,menuElement) is a void method call, and thus it cannot be parameterized
    5Expression filter.setUp(criteria) is a void method call, and thus it cannot be parameterized
    6Expression parseMenu(menu,menuElement) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression parseMenu(menu,menuElement) is a void method call, and thus it cannot be parameterized
    8Expression filter.setUp(criteria) is a void method call, and thus it cannot be parameterized
    9Expression menuBar.add(menu) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression menuBar.add(menu) 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
    12Expression menuBar.add(menu) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression menuBar.add(menu) is a void method call, and thus it cannot be parameterized
    14Expression assertEquals("filter result",true,result) is a void method call, and thus it cannot be parameterized