@Test public void testSetGetArtifactAction() { mockHelper.replayAll(); classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean); mockHelper.verifyAll(); classUnderTest.setArtifactAction(ArtifactAction.INSTALL); assertEquals(ArtifactAction.INSTALL, classUnderTest.getArtifactAction()); }
@Test public void testSetGetDisplayType() { mockHelper.replayAll(); classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean); mockHelper.verifyAll(); classUnderTest.setDisplayType(coreType); assertEquals(coreType, classUnderTest.getDisplayType()); }
@Test public void testToString() { mockHelper.replayAll(); classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean); mockHelper.verifyAll(); assertNotNull(classUnderTest.toString()); assertTrue(classUnderTest.toString().length() > 0); }
@Test public void testSetGetChecksum() { mockHelper.replayAll(); classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean); mockHelper.verifyAll(); assertEquals(coreChecksum, classUnderTest.getChecksum()); classUnderTest.setChecksum(2); assertEquals(2, classUnderTest.getChecksum()); }
@Test public void testSetGetInstalled() { mockHelper.replayAll(); classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean); mockHelper.verifyAll(); assertEquals(coreIsInstalled, classUnderTest.isInstalled()); classUnderTest.setInstalled(false); assertFalse(classUnderTest.isInstalled()); }
@Test public void testIsTranslationArtifact() { mockHelper.replayAll(); classUnderTest = new ArtifactStatus(mockTranslationArtifactXmlBean); mockHelper.verifyAll(); assertTrue(classUnderTest.isTranslationArtifact()); assertFalse(classUnderTest.isPluginArtifact()); assertFalse(classUnderTest.isCoreArtifact()); }
@Test public void testSetGetType() { mockHelper.replayAll(); classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean); mockHelper.verifyAll(); assertEquals(UpdateUtil.CORE_ARTIFACT_ID, classUnderTest.getType()); classUnderTest.setType(UpdateUtil.PLUGIN_ARTIFACT_ID); assertEquals(UpdateUtil.PLUGIN_ARTIFACT_ID, classUnderTest.getType()); }
@Test public void testArtifactStatusArtifactXmlBean() { mockHelper.replayAll(); classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean); mockHelper.verifyAll(); assertEquals(coreArtifactName, classUnderTest.getName()); assertEquals(coreIsInstalled, classUnderTest.isInstalled()); assertEquals(this.coreSize, classUnderTest.getSize()); assertEquals(coreChecksum, classUnderTest.getChecksum()); }
@Test public void testEqualsAndHashCode() { mockHelper.replayAll(); final ArtifactStatus a = new ArtifactStatus(mockCoreArtifactXmlBean); // original object final ArtifactStatus b = new ArtifactStatus(mockCoreArtifactXmlBean); // another object that has the // same values as the original final ArtifactStatus c = new ArtifactStatus(mockPluginArtifactXmlBean); // another object with different // values final ArtifactStatus d = new ArtifactStatus(mockCoreArtifactXmlBean) { private static final long serialVersionUID = 1L; }; // a subclass of Foo with the same values as the original new EqualsTester(a, b, c, d); mockHelper.verifyAll(); a.setName(null); b.setName(null); d.setName(null); new EqualsTester(a, b, c, d); // different only by type - same name a.setName(coreArtifactName); b.setName(coreArtifactName); c.setName(coreArtifactName); a.setType(null); b.setType(null); d.setType(null); new EqualsTester(a, b, c, d); a.setType(coreType); b.setType(coreType); c.setType(null); d.setType(coreType); new EqualsTester(a, b, c, d); a.setType(null); b.setType(null); c.setType(pluginType); d.setType(null); new EqualsTester(a, b, c, d); }
@Before public void setUp() throws Exception { mockCoreArtifactXmlBean = mockHelper.createMock(ArtifactXmlBean.class); expect(mockCoreArtifactXmlBean.getName()).andStubReturn(coreArtifactName); expect(mockCoreArtifactXmlBean.isInstalled()).andStubReturn(coreIsInstalled); expect(mockCoreArtifactXmlBean.getSize()).andStubReturn(coreSize); expect(mockCoreArtifactXmlBean.getChecksum()).andStubReturn(coreChecksum); expect(mockCoreArtifactXmlBean.getType()).andStubReturn(coreType); mockPluginArtifactXmlBean = mockHelper.createMock(ArtifactXmlBean.class); expect(mockPluginArtifactXmlBean.getName()).andStubReturn(pluginArtifactName); expect(mockPluginArtifactXmlBean.isInstalled()).andStubReturn(pluginIsInstalled); expect(mockPluginArtifactXmlBean.getSize()).andStubReturn(pluginSize); expect(mockPluginArtifactXmlBean.getChecksum()).andStubReturn(pluginChecksum); expect(mockPluginArtifactXmlBean.getType()).andStubReturn(pluginType); mockTranslationArtifactXmlBean = mockHelper.createMock(ArtifactXmlBean.class); expect(mockTranslationArtifactXmlBean.getName()).andStubReturn(translationArtifactName); expect(mockTranslationArtifactXmlBean.isInstalled()).andStubReturn(translationIsInstalled); expect(mockTranslationArtifactXmlBean.getSize()).andStubReturn(translationSize); expect(mockTranslationArtifactXmlBean.getChecksum()).andStubReturn(translationChecksum); expect(mockTranslationArtifactXmlBean.getType()).andStubReturn(translationType); // For the serialization test in superclass - cannot use mockHelper because the replay needs to // be // done here. ArtifactXmlBean mockArtifactXmlBean = EasyMock.createMock(ArtifactXmlBean.class); expect(mockArtifactXmlBean.getName()).andStubReturn(coreArtifactName); expect(mockArtifactXmlBean.isInstalled()).andStubReturn(coreIsInstalled); expect(mockArtifactXmlBean.getSize()).andStubReturn(coreSize); expect(mockArtifactXmlBean.getChecksum()).andStubReturn(coreChecksum); expect(mockArtifactXmlBean.getType()).andStubReturn(coreType); replay(mockArtifactXmlBean); super.serializableToTest = new ArtifactStatus(mockArtifactXmlBean); verify(mockArtifactXmlBean); }