gerrithudsontrigger/src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/gerritnotifier/model/MemoryImprintTest.java
/**
     * Tests the reset method of the class {@link BuildMemory.MemoryImprint}.
     * With two previous builds.
     */
Tests the reset method of the class  BuildMemory.MemoryImprint.
With two previous builds.
Tests the reset method of the class BuildMemory . MemoryImprint . With two previous builds .
@Test
    public void testResetTwoPreviousBuilds() {
        AbstractProject project = mock(AbstractProject.class);
        AbstractBuild build = mock(AbstractBuild.class);
        when(build.getProject()).thenReturn(project);
        AbstractProject project2 = mock(AbstractProject.class);
        AbstractBuild build2 = mock(AbstractBuild.class);
        when(build2.getProject()).thenReturn(project2);
        BuildMemory.MemoryImprint imprint = new BuildMemory.MemoryImprint(Setup.createPatchsetCreated());
        imprint.set(project, build);
        imprint.set(project2, build2);
        assertEquals(2, imprint.getEntries().length);
        imprint.reset(project2);
        assertEquals(2, imprint.getEntries().length);
        assertEquals(project2, imprint.getEntries()[1].getProject());
        assertNull(imprint.getEntries()[1].getBuild());
        assertFalse(imprint.getEntries()[0].isBuildCompleted());
    }
@ Test public void testResetTwoPreviousBuilds ( ) { AbstractProject project = mock ( AbstractProject . class ) ; AbstractBuild build = mock ( AbstractBuild . class ) ; when ( build . getProject ( ) ) . thenReturn ( project ) ; AbstractProject project2 = mock ( AbstractProject . class ) ; AbstractBuild build2 = mock ( AbstractBuild . class ) ; when ( build2 . getProject ( ) ) . thenReturn ( project2 ) ; BuildMemory . MemoryImprint imprint = new BuildMemory . MemoryImprint ( Setup . createPatchsetCreated ( ) ) ; imprint . set ( project , build ) ; imprint . set ( project2 , build2 ) ; assertEquals ( 2 , imprint . getEntries ( ) . length ) ; imprint . reset ( project2 ) ; assertEquals ( 2 , imprint . getEntries ( ) . length ) ; assertEquals ( project2 , imprint . getEntries ( ) [ 1 ] . getProject ( ) ) ; assertNull ( imprint . getEntries ( ) [ 1 ] . getBuild ( ) ) ; assertFalse ( imprint . getEntries ( ) [ 0 ] . isBuildCompleted ( ) ) ; }
Tests the reset method of the class {@link BuildMemory.MemoryImprint}.
Tests the reset method of the class { @link BuildMemory . MemoryImprint } .