From 92f2b005aba392cb96007060484d9951aa013f77 Mon Sep 17 00:00:00 2001
From: pkupczyk <pkupczyk>
Date: Tue, 14 Aug 2012 12:14:58 +0000
Subject: [PATCH] SP-159 / BIS-93: YeastLab: Implement a way to download
 template files as part of the Custom Import functionality: - added some
 junits

SVN: 26366
---
 .../server/business/bo/ProjectBOTest.java     | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBOTest.java
index b411387b6a9..c741bad6cc1 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBOTest.java
@@ -56,6 +56,41 @@ public final class ProjectBOTest extends AbstractBOTest
         return new ProjectBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, relationshipService);
     }
 
+    @Test
+    public final void testLoadByPermId()
+    {
+        final ProjectBO projectBO = createProjectBO();
+
+        context.checking(new Expectations()
+            {
+                {
+                    one(projectDAO).tryGetByPermID("20120814110011738-105");
+                    will(returnValue(EXAMPLE_PROJECT));
+                }
+            });
+
+        projectBO.loadByPermId("20120814110011738-105");
+        ProjectPE project = projectBO.getProject();
+
+        assertEquals(EXAMPLE_PROJECT, project);
+    }
+
+    @Test(expectedExceptions = UserFailureException.class)
+    public final void testLoadByPermIdNonexistent()
+    {
+        final ProjectBO projectBO = createProjectBO();
+
+        context.checking(new Expectations()
+            {
+                {
+                    one(projectDAO).tryGetByPermID("UNKNOWN-PERM-ID");
+                    will(returnValue(null));
+                }
+            });
+
+        projectBO.loadByPermId("UNKNOWN-PERM-ID");
+    }
+
     @Test
     public void testDeleteProjectWithNoExperiments()
     {
-- 
GitLab