[kune-commits] r1297 - trunk/src/test/java/cc/kune/core/server/manager/file
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Fri Mar 25 22:39:03 CET 2011
Author: vjrj_
Date: 2011-03-25 22:39:02 +0100 (Fri, 25 Mar 2011)
New Revision: 1297
Modified:
trunk/src/test/java/cc/kune/core/server/manager/file/EntityLogoUploadManagerTest.java
trunk/src/test/java/cc/kune/core/server/manager/file/ImageUtilsDefaultTest.java
Log:
Some test fixed after refactorization
Modified: trunk/src/test/java/cc/kune/core/server/manager/file/EntityLogoUploadManagerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/file/EntityLogoUploadManagerTest.java 2011-03-25 20:39:42 UTC (rev 1296)
+++ trunk/src/test/java/cc/kune/core/server/manager/file/EntityLogoUploadManagerTest.java 2011-03-25 21:39:02 UTC (rev 1297)
@@ -31,14 +31,13 @@
import cc.kune.core.client.errors.SessionExpiredException;
import cc.kune.core.client.errors.UserMustBeLoggedException;
-import cc.kune.core.server.manager.file.EntityLogoUploadManager;
import cc.kune.core.shared.dto.StateContainerDTO;
import com.google.inject.Inject;
public class EntityLogoUploadManagerTest extends ContentServiceIntegrationTest {
- private static final String TEST_FILE = "src/test/java/org/ourproject/kune/platf/server/manager/file/orig.png";
+ private static final String TEST_FILE = "src/test/java/cc/kune/core/server/manager/file/orig.png";
@Inject
EntityLogoUploadManager manager;
@@ -50,7 +49,7 @@
@Test
public void testCreateLogo() throws Exception {
manager.createUploadedFile(super.getSiteDefaultContent().getStateToken(), "image/png", new File(TEST_FILE));
- StateContainerDTO defaultContent = super.getSiteDefaultContent();
+ final StateContainerDTO defaultContent = super.getSiteDefaultContent();
assertTrue(defaultContent.getGroup().hasLogo());
}
Modified: trunk/src/test/java/cc/kune/core/server/manager/file/ImageUtilsDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/file/ImageUtilsDefaultTest.java 2011-03-25 20:39:42 UTC (rev 1296)
+++ trunk/src/test/java/cc/kune/core/server/manager/file/ImageUtilsDefaultTest.java 2011-03-25 21:39:02 UTC (rev 1297)
@@ -32,8 +32,6 @@
import org.junit.BeforeClass;
import org.junit.Test;
-import cc.kune.core.server.manager.file.ImageUtilsDefault;
-
/**
* If you get a UnsatisfiedLinkError this is a problem with jmagick installation
* (in debian, apt-get install libjmagick6-jni, and add
@@ -46,14 +44,14 @@
*/
public class ImageUtilsDefaultTest {
- private static final String IMG_PATH = "src/test/java/org/ourproject/kune/platf/server/manager/file/";
- private static String[] images = { "orig.png", "orig.gif", "orig.jpg", "orig.tiff", "orig.pdf" };
private static String imageDest;
+ private static String[] images = { "orig.png", "orig.gif", "orig.jpg", "orig.tiff", "orig.pdf" };
+ private static final String IMG_PATH = "src/test/java/cc/kune/core/server/manager/file/";
private static String pdf = "orig.pdf";
@AfterClass
public static void after() {
- File file = new File(imageDest);
+ final File file = new File(imageDest);
file.delete();
}
@@ -69,9 +67,9 @@
@Test
public void generateIcon() throws MagickException, FileNotFoundException {
- for (String image : images) {
+ for (final String image : images) {
ImageUtilsDefault.createThumb(IMG_PATH + image, imageDest, 16, 16);
- Dimension dimension = ImageUtilsDefault.getDimension(imageDest);
+ final Dimension dimension = ImageUtilsDefault.getDimension(imageDest);
assertEquals(16, (int) dimension.getHeight());
assertEquals(16, (int) dimension.getWidth());
}
@@ -79,9 +77,9 @@
@Test
public void generateThumb() throws MagickException, FileNotFoundException {
- for (String image : images) {
+ for (final String image : images) {
ImageUtilsDefault.createThumb(IMG_PATH + image, imageDest, 100, 85);
- Dimension dimension = ImageUtilsDefault.getDimension(imageDest);
+ final Dimension dimension = ImageUtilsDefault.getDimension(imageDest);
assertEquals(85, (int) dimension.getHeight());
assertEquals(85, (int) dimension.getWidth());
}
@@ -89,7 +87,7 @@
@Test
public void testProportionalHigher() {
- Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(500, 1000, 100);
+ final Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(500, 1000, 100);
assertEquals(100, proportionalDim.width);
assertEquals(200, proportionalDim.height);
assertEquals(0, ImageUtilsDefault.calculateCenteredCoordinate(proportionalDim.width, 100));
@@ -98,7 +96,7 @@
@Test
public void testProportionalHigherLikeSamples() {
- Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(1200, 1600, 100);
+ final Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(1200, 1600, 100);
assertEquals(100, proportionalDim.width);
assertEquals(133, proportionalDim.height);
assertEquals(0, ImageUtilsDefault.calculateCenteredCoordinate(proportionalDim.width, 100));
@@ -107,7 +105,7 @@
@Test
public void testProportionalHigherSame() {
- Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(20, 100, 100);
+ final Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(20, 100, 100);
assertEquals(20, proportionalDim.width);
assertEquals(100, proportionalDim.height);
assertEquals(0, ImageUtilsDefault.calculateCenteredCoordinate(proportionalDim.width, 100));
@@ -116,7 +114,7 @@
@Test
public void testProportionalHigherSmaller() {
- Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(20, 10, 100);
+ final Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(20, 10, 100);
assertEquals(20, proportionalDim.width);
assertEquals(10, proportionalDim.height);
assertEquals(0, ImageUtilsDefault.calculateCenteredCoordinate(proportionalDim.width, 100));
@@ -125,35 +123,35 @@
@Test
public void testProportionalToBiggerNormal() {
- Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(600, 300, 300, false);
+ final Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(600, 300, 300, false);
assertEquals(300, proportionalDim.width);
assertEquals(150, proportionalDim.height);
}
@Test
public void testProportionalToBiggerSame() {
- Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(600, 300, 600, false);
+ final Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(600, 300, 600, false);
assertEquals(600, proportionalDim.width);
assertEquals(300, proportionalDim.height);
}
@Test
public void testProportionalToBiggerSmaller() {
- Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(600, 300, 700, false);
+ final Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(600, 300, 700, false);
assertEquals(600, proportionalDim.width);
assertEquals(300, proportionalDim.height);
}
@Test
public void testProportionalToBiggerWider() {
- Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(300, 600, 200, false);
+ final Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(300, 600, 200, false);
assertEquals(100, proportionalDim.width);
assertEquals(200, proportionalDim.height);
}
@Test
public void testProportionalWider() {
- Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(1000, 500, 100);
+ final Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(1000, 500, 100);
assertEquals(200, proportionalDim.width);
assertEquals(100, proportionalDim.height);
assertEquals(50, ImageUtilsDefault.calculateCenteredCoordinate(proportionalDim.width, 100));
@@ -162,7 +160,7 @@
@Test
public void testProportionalWiderSame() {
- Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(100, 20, 100);
+ final Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(100, 20, 100);
assertEquals(100, proportionalDim.width);
assertEquals(20, proportionalDim.height);
assertEquals(0, ImageUtilsDefault.calculateCenteredCoordinate(proportionalDim.width, 100));
@@ -171,7 +169,7 @@
@Test
public void testProportionalWiderSmaller() {
- Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(5, 10, 100);
+ final Dimension proportionalDim = ImageUtilsDefault.calculatePropDim(5, 10, 100);
assertEquals(5, proportionalDim.width);
assertEquals(10, proportionalDim.height);
assertEquals(0, ImageUtilsDefault.calculateCenteredCoordinate(proportionalDim.width, 100));
@@ -180,9 +178,9 @@
@Test
public void testResize() throws MagickException, FileNotFoundException {
- for (String image : images) {
+ for (final String image : images) {
assertTrue(ImageUtilsDefault.scaleImage(IMG_PATH + image, imageDest, 100, 100));
- Dimension dimension = ImageUtilsDefault.getDimension(imageDest);
+ final Dimension dimension = ImageUtilsDefault.getDimension(imageDest);
assertEquals(100, (int) dimension.getHeight());
assertEquals(100, (int) dimension.getWidth());
}
@@ -190,9 +188,9 @@
@Test
public void testSize() throws MagickException {
- for (String image : images) {
+ for (final String image : images) {
if (!image.equals(pdf)) {
- Dimension dimension = ImageUtilsDefault.getDimension(IMG_PATH + image);
+ final Dimension dimension = ImageUtilsDefault.getDimension(IMG_PATH + image);
assertEquals(400, (int) dimension.getHeight());
assertEquals(300, (int) dimension.getWidth());
}
More information about the kune-commits
mailing list