[kune-commits] r1021 - in trunk: . doc src/main/java/org/ourproject/kune/platf/client/dto src/main/java/org/ourproject/kune/platf/client/ui src/main/java/org/ourproject/kune/platf/server/domain src/main/java/org/ourproject/kune/platf/server/init src/main/java/org/ourproject/kune/workspace/client/ctxnav src/main/java/org/ourproject/kune/workspace/client/sitebar/siteusermenu src/main/java/org/ourproject/kune/workspace/client/title src/main/rails/publicspace/config src/test/java/org/ourproject/kune/platf/client/actions src/test/java/org/ourproject/kune/platf/client/state src/test/java/org/ourproject/kune/platf/client/tool src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload src/test/java/org/ourproject/kune/platf/server/access src/test/java/org/ourproject/kune/platf/server/auth src/test/java/org/ourproject/kune/platf/server/manager src/test/java/org/ourproject/kune/platf/server/manager/file src/test/java/org/ourproject/kune/workspace/client/editor src/test/java/org/ourproject/kune/workspace/client/licensewizard src/test/java/org/ourproject/kune/workspace/client/tags

vjrj vjrj at ourproject.org
Fri Jan 2 20:34:13 CET 2009


Author: vjrj
Date: 2009-01-02 20:34:01 +0100 (Fri, 02 Jan 2009)
New Revision: 1021

Added:
   trunk/doc/kune-ene-09.odp
Modified:
   trunk/TODO
   trunk/doc/kune-dic-08.odp
   trunk/doc/kune-dic-08.pdf
   trunk/pom.xml
   trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java
   trunk/src/main/java/org/ourproject/kune/platf/server/domain/AccessLists.java
   trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
   trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupList.java
   trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteusermenu/SiteUserMenuPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitleView.java
   trunk/src/main/rails/publicspace/config/routes.rb
   trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java
   trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java
   trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java
   trunk/src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload/FileUploaderPresenterTest.java
   trunk/src/test/java/org/ourproject/kune/platf/server/access/FinderTest.java
   trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptorTest.java
   trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java
   trunk/src/test/java/org/ourproject/kune/platf/server/manager/ContentManagerTest.java
   trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManagerTest.java
   trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
   trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenterTest.java
   trunk/src/test/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenterTest.java
Log:
route.rb now works with /public/a.b.c.d, new Mockito version, presentation updated, other enhancements.

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/TODO	2009-01-02 19:34:01 UTC (rev 1021)
@@ -52,6 +52,8 @@
   http://mojo.codehaus.org/exec-maven-plugin/introduction.html
 <vjrj> rails group-shortname.kune-site-domain/tool-name/folder-id/doc-id routing, maybe use:
   http://agilewebdevelopment.com/plugins/request_routing
+  http://wiki.rubyonrails.org/rails/pages/Request+Routing
+  http://svn.danwebb.net/external/rails/plugins/request_routing/trunk/README
 <vjrj> Strip html better in RTE, I18nTranslator, Chat
   http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/b4a27c80f50581cc
 <vjrj> RTE right to left writing

Modified: trunk/doc/kune-dic-08.odp
===================================================================
(Binary files differ)

Modified: trunk/doc/kune-dic-08.pdf
===================================================================
(Binary files differ)

Added: trunk/doc/kune-ene-09.odp
===================================================================
(Binary files differ)


Property changes on: trunk/doc/kune-ene-09.odp
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/pom.xml	2009-01-02 19:34:01 UTC (rev 1021)
@@ -239,14 +239,19 @@
     <!-- jetty dependencies -->
     <dependency>
       <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty-util</artifactId>
-      <version>6.1.5</version>
-      <scope>provided</scope>
+       <artifactId>jetty-util</artifactId>
+        <version>6.1.5</version>
+        <!-- <version>7.0.0.pre5</version> -->
+        <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty</artifactId>
+      <artifactId>maven-jetty-plugin</artifactId>
       <version>6.1.5</version>
+      <!--
+      <artifactId>jetty-maven-plugin</artifactId>
+      <version>7.0.0.pre5</version>
+       -->
       <scope>provided</scope>
     </dependency>
 
@@ -259,6 +264,11 @@
 
     <!-- testing dependencies -->
     <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <version>1.6</version>
+    </dependency>
+    <dependency>
       <groupId>com.h2database</groupId>
       <artifactId>h2</artifactId>
       <version>1.0.20070617</version>
@@ -371,11 +381,11 @@
         <configuration>
           <source>1.5</source>
           <target>1.5</target>
-					<!-- Uncomment and run mvn with -X -e if we have same compile problems
+                    <!-- Uncomment and run mvn with -X -e if we have same compile problems
           <compilerArgument>-verbose</compilerArgument>
-          <fork>true</fork> 
-					<verbose>true</verbose>
-					-->
+          <fork>true</fork>
+                    <verbose>true</verbose>
+                    -->
         </configuration>
       </plugin>
       <plugin>
@@ -437,8 +447,13 @@
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>maven-jetty-plugin</artifactId>
         <version>6.1.5</version>
+        <!--
+        <artifactId>jetty-maven-plugin</artifactId>
+        <version>7.0.0.pre5</version>
+        -->
         <configuration>
           <contextPath>/</contextPath>
+          <reload>manual</reload>
           <scanIntervalSeconds>0</scanIntervalSeconds>
         </configuration>
       </plugin>

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -23,6 +23,17 @@
 
 import com.google.gwt.user.client.rpc.IsSerializable;
 
+/**
+ * <pre>
+ * http://en.wikipedia.org/wiki/Fragment_identifier
+ * http://www.w3.org/DesignIssues/Fragment.html
+ * </pre>
+ * 
+ * <pre>
+ * When an agent (such as a Web browser) requests a resource from a Web server, the agent sends the URI to the server, but does not send the fragment.
+ * </pre>
+ * 
+ */
 public class StateToken implements IsSerializable {
     public static final String SEPARATOR = ".";
     private static final String[] EMPTY = new String[0];
@@ -131,14 +142,14 @@
     public String getPublicUrl() {
         String publicUrl = "http://";
 
-        String separator = "/";
+        String separator = ".";
 
         // FIXME: Maybe get from InitData the site.domain
         String port = WindowUtils.getLocation().getPort();
         publicUrl += WindowUtils.getLocation().getHostName() + (port == null ? "" : ":" + port) + "/public";
 
         if (group != null) {
-            publicUrl += separator + group;
+            publicUrl += "/" + group;
         }
         if (tool != null) {
             publicUrl += separator + tool;

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -36,7 +36,6 @@
     private boolean useDoubleClick;
     private ClickListener listener;
     private String currentText;
-    private String oldText;
     private MouseListenerAdapter mouseOverListener;
     private final AbstractLabel label;
     private String doubleClickToRenameLabel;
@@ -81,11 +80,6 @@
         onEdit.add(slot);
     }
 
-    public void restoreOldText() {
-        label.setText(oldText);
-        this.currentText = this.oldText;
-    }
-
     public void setClickToRenameLabel(final String clickToRenameLabel) {
         this.clickToRenameLabel = clickToRenameLabel;
     }
@@ -114,7 +108,6 @@
     }
 
     public void setText(final String text) {
-        this.oldText = this.currentText;
         this.currentText = text;
         label.setText(text);
     }
@@ -122,6 +115,7 @@
     private void afterEdit() {
         String text = editor.getText();
         onEdit.fire(currentText, text);
+        setText(text);
         editor.setVisible(false);
         editor.setReadOnly(true);
         label.setVisible(true);
@@ -136,7 +130,6 @@
         hp.add((Widget) label);
         initWidget(hp);
         this.currentText = text;
-        this.oldText = text;
         this.useDoubleClick = useDoubleClick;
         this.listener = new ClickListener() {
             public void onClick(final Widget sender) {

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/AccessLists.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/AccessLists.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/AccessLists.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -31,13 +31,16 @@
 @Entity
 @Table(name = "access_lists")
 public class AccessLists {
+
     @OneToOne(cascade = CascadeType.ALL)
     protected GroupList admins;
 
     @OneToOne(cascade = CascadeType.ALL)
     protected GroupList editors;
+
     @OneToOne(cascade = CascadeType.ALL)
     protected GroupList viewers;
+
     @Id
     @GeneratedValue
     private Long id;

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -43,6 +43,7 @@
 import javax.persistence.ManyToOne;
 import javax.persistence.OneToMany;
 import javax.persistence.OneToOne;
+import javax.persistence.OrderBy;
 import javax.persistence.Table;
 import javax.persistence.Transient;
 import javax.persistence.Version;
@@ -73,6 +74,7 @@
     @Version
     private int version;
 
+    @OrderBy("name DESC")
     @IndexedEmbedded
     @ManyToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST })
     private List<Tag> tags;

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupList.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupList.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/GroupList.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -32,12 +32,14 @@
 import javax.persistence.Inheritance;
 import javax.persistence.InheritanceType;
 import javax.persistence.ManyToMany;
+import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
 @Entity
 @Table(name = "group_list")
 @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
 public class GroupList {
+    @OrderBy("shortName ASC")
     @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
     List<Group> list;
 
@@ -114,6 +116,7 @@
         this.mode = mode;
     }
 
+    @Override
     public String toString() {
         return "GroupList[(" + mode + "): " + list + "]";
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -178,5 +178,4 @@
                 "http://www.gnu.org/licenses/gpl.html", false, true, false, "", "images/lic/gnu-gpl.gif");
         licenseManager.persist(license);
     }
-
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -78,6 +78,14 @@
         TreeNode node = treePanel.getNodeById(nodeId);
         if (node == null) {
             // Log.info("Adding tree node " + nodeId);
+
+            // FIXME: maybe to solve the length issues with items, we can store
+            // a truncated title also and use something similar to:
+            // String nodeText = Format.ellipsis(item.getText(),
+            // ws.getEntityWorkspace().getContextTopBar().getPanel().getOffsetWidth()
+            // / 8);
+            // the problem is that editor uses this value, then we have to
+            // restore the real value before edit
             final TreeNode child = new TreeNode(item.getText());
             child.setId(nodeId);
             final String icon = item.getIconUrl();
@@ -258,6 +266,7 @@
             public boolean doBeforeStartEdit(final Editor source, final ExtElement boundEl, final Object value) {
                 return isEditable;
             }
+
         });
         // test !?
         treeEditor.setAutosize(false);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteusermenu/SiteUserMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteusermenu/SiteUserMenuPanel.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteusermenu/SiteUserMenuPanel.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -73,7 +73,7 @@
         userMenu.addItem(userHomePage);
         final Item userPreferences = new Item(i18n.t("Your preferences"));
         userPreferences.setId(USER_PREFERENCES_MENU_ITEM);
-        userPreferences.setIcon("images/kune-preferences.gif");
+        userPreferences.setIcon("images/emblem-system.png");
         userPreferences.addListener(new BaseItemListenerAdapter() {
             @Override
             public void onClick(final BaseItem item, final EventObject e) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePanel.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitlePanel.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -52,10 +52,6 @@
         icon.setVisible(false);
     }
 
-    public void restoreOldTitle() {
-        titleLabel.restoreOldText();
-    }
-
     public void setContentIcon(final String iconUrl) {
         icon.setUrl(iconUrl);
     }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitleView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitleView.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntityTitleView.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -23,8 +23,6 @@
 
 public interface EntityTitleView extends View {
 
-    void restoreOldTitle();
-
     void setContentIcon(String iconUrl);
 
     void setContentIconVisible(boolean visible);

Modified: trunk/src/main/rails/publicspace/config/routes.rb
===================================================================
--- trunk/src/main/rails/publicspace/config/routes.rb	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/main/rails/publicspace/config/routes.rb	2009-01-02 19:34:01 UTC (rev 1021)
@@ -1,6 +1,8 @@
 ActionController::Routing::Routes.draw do |map|
   map.root :controller => 'kunedbg'
   map.connect 'public/:group/:tool/:folder/:content', :controller => 'contents', :action => 'show'
+  map.connect 'public/:group.:tool.:folder.:content', :controller => 'contents', :action => 'show',
+    :requirements => {:group => /[a-z0-9_\\-]+/, :tool => /[a-z0-9_\\-]+/, :folder => /\d+/, :content => /\d+/ }
   map.connect '/public/debug/:action/:id', :controller => 'kunedbg'
   #map.connect '/public/:controller/:action/:id.:format'
 end

Modified: trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionRegistryTest.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -23,7 +23,7 @@
 
     @Test
     public void actionsEmptyButNeverNull() {
-        Mockito.stub(session.isLogged()).toReturn(true);
+        Mockito.when(session.isLogged()).thenReturn(true);
         checkActionLists(0, new AccessRightsDTO(true, true, true), true);
         checkActionLists(0, new AccessRightsDTO(true, true, true), false);
         checkActionLists(0, new AccessRightsDTO(false, true, true), true);
@@ -56,7 +56,7 @@
 
     @Test
     public void mustBeAuthFalse() {
-        Mockito.stub(session.isLogged()).toReturn(false);
+        Mockito.when(session.isLogged()).thenReturn(false);
         addDefActions();
         checkActionLists(0, new AccessRightsDTO(false, true, true), true);
         checkActionLists(1, new AccessRightsDTO(false, true, true), false);
@@ -64,7 +64,7 @@
 
     @Test
     public void testAddWhenAdmin() {
-        Mockito.stub(session.isLogged()).toReturn(true);
+        Mockito.when(session.isLogged()).thenReturn(true);
         addDefActions();
         checkActionLists(2, new AccessRightsDTO(true, true, true), true);
         checkActionLists(3, new AccessRightsDTO(true, true, true), false);
@@ -72,7 +72,7 @@
 
     @Test
     public void testAddWhenEditor() {
-        Mockito.stub(session.isLogged()).toReturn(true);
+        Mockito.when(session.isLogged()).thenReturn(true);
         addDefActions();
         checkActionLists(1, new AccessRightsDTO(false, true, true), true);
         checkActionLists(2, new AccessRightsDTO(false, true, true), false);
@@ -80,7 +80,7 @@
 
     @Test
     public void testAddWhenViewer() {
-        Mockito.stub(session.isLogged()).toReturn(true);
+        Mockito.when(session.isLogged()).thenReturn(true);
         addDefActions();
         checkActionLists(0, new AccessRightsDTO(false, false, true), true);
         checkActionLists(1, new AccessRightsDTO(false, false, true), false);

Modified: trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -39,7 +39,7 @@
         session = Mockito.mock(Session.class);
         history = Mockito.mock(HistoryWrapper.class);
         stateManager = new StateManagerDefault(contentProvider, session, history);
-        Mockito.stub(session.getUserHash()).toReturn(HASH);
+        Mockito.when(session.getUserHash()).thenReturn(HASH);
         state = Mockito.mock(StateAbstractDTO.class);
         stateChangeListener = new MockListener<StateAbstractDTO>();
         groupChangeListener = new MockListener2<String, String>();
@@ -116,7 +116,7 @@
     public void normalStartLoggedUser() {
         // When a user enter reload state, also if the application is starting
         // (and the user was logged)
-        Mockito.stub(history.getToken()).toReturn("");
+        Mockito.when(history.getToken()).thenReturn("");
         stateManager.reload();
         Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),
                 (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
@@ -189,7 +189,7 @@
 
     private void changeState(String... tokens) {
         for (String token : tokens) {
-            Mockito.stub(state.getStateToken()).toReturn(new StateToken(token));
+            Mockito.when(state.getStateToken()).thenReturn(new StateToken(token));
             stateManager.setState(state);
         }
     }
@@ -198,8 +198,8 @@
         stateManager.addBeforeStateChangeListener(beforeChangeListener1);
         stateManager.addBeforeStateChangeListener(beforeChangeListener2);
         String newToken = "something";
-        Mockito.stub(beforeChangeListener1.beforeAction()).toReturn(value);
-        Mockito.stub(beforeChangeListener2.beforeAction()).toReturn(value2);
+        Mockito.when(beforeChangeListener1.beforeAction()).thenReturn(value);
+        Mockito.when(beforeChangeListener2.beforeAction()).thenReturn(value2);
         return newToken;
     }
 

Modified: trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -40,7 +40,7 @@
     public void addTwoToolsWithSameNameMustGiveException() {
         setToolNames();
         final ToolSelectorItem toolSelectorItemCopy = Mockito.mock(ToolSelectorItem.class);
-        Mockito.stub(toolSelectorItemCopy.getShortName()).toReturn(TOOL1_NAME);
+        Mockito.when(toolSelectorItemCopy.getShortName()).thenReturn(TOOL1_NAME);
         toolSelector.addTool(toolSelectorItem1);
         toolSelector.addTool(toolSelectorItemCopy);
     }
@@ -96,8 +96,8 @@
     }
 
     public void setToolNames() {
-        Mockito.stub(toolSelectorItem1.getShortName()).toReturn(TOOL1_NAME);
-        Mockito.stub(toolSelectorItem2.getShortName()).toReturn(TOOL2_NAME);
+        Mockito.when(toolSelectorItem1.getShortName()).thenReturn(TOOL1_NAME);
+        Mockito.when(toolSelectorItem2.getShortName()).thenReturn(TOOL2_NAME);
     }
 
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload/FileUploaderPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload/FileUploaderPresenterTest.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/ui/dialogs/upload/FileUploaderPresenterTest.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -25,12 +25,12 @@
         view = Mockito.mock(FileUploaderView.class);
         presenter = new FileUploaderPresenter(session);
         presenter.init(view);
-        Mockito.stub(session.getUserHash()).toReturn(SOMEUSER_HASH);
+        Mockito.when(session.getUserHash()).thenReturn(SOMEUSER_HASH);
     }
 
     @Test
     public void testFirstAddFromDocInSameContainer() {
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.1.1"));
+        Mockito.when(session.getCurrentStateToken()).thenReturn(new StateToken("group.docs.1.1"));
         assertTrue(presenter.checkFolderChange());
         Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
                 DocumentClientTool.TYPE_UPLOADEDFILE);
@@ -38,7 +38,7 @@
 
     @Test
     public void testFirstAddInSameContainer() {
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.1"));
+        Mockito.when(session.getCurrentStateToken()).thenReturn(new StateToken("group.docs.1"));
         assertTrue(presenter.checkFolderChange());
         Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
                 DocumentClientTool.TYPE_UPLOADEDFILE);
@@ -46,10 +46,10 @@
 
     @Test
     public void testSomeAddsInDiffContainersButNotUploading() {
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.1"));
+        Mockito.when(session.getCurrentStateToken()).thenReturn(new StateToken("group.docs.1"));
         assertTrue(presenter.checkFolderChange());
-        Mockito.stub(view.hasUploadingFiles()).toReturn(false);
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.2"));
+        Mockito.when(view.hasUploadingFiles()).thenReturn(false);
+        Mockito.when(session.getCurrentStateToken()).thenReturn(new StateToken("group.docs.2"));
         assertTrue(presenter.checkFolderChange());
         Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
                 DocumentClientTool.TYPE_UPLOADEDFILE);
@@ -59,10 +59,10 @@
 
     @Test
     public void testSomeAddsInDiffContainersButUploading() {
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.1"));
+        Mockito.when(session.getCurrentStateToken()).thenReturn(new StateToken("group.docs.1"));
         assertTrue(presenter.checkFolderChange());
-        Mockito.stub(view.hasUploadingFiles()).toReturn(true);
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.2"));
+        Mockito.when(view.hasUploadingFiles()).thenReturn(true);
+        Mockito.when(session.getCurrentStateToken()).thenReturn(new StateToken("group.docs.2"));
         assertFalse(presenter.checkFolderChange());
         Mockito.verify(view, Mockito.times(1)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
                 DocumentClientTool.TYPE_UPLOADEDFILE);
@@ -72,9 +72,9 @@
 
     @Test
     public void testSomeAddsInSameContainer() {
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.1"));
+        Mockito.when(session.getCurrentStateToken()).thenReturn(new StateToken("group.docs.1"));
         assertTrue(presenter.checkFolderChange());
-        Mockito.stub(session.getCurrentStateToken()).toReturn(new StateToken("group.docs.1"));
+        Mockito.when(session.getCurrentStateToken()).thenReturn(new StateToken("group.docs.1"));
         assertTrue(presenter.checkFolderChange());
         Mockito.verify(view, Mockito.times(2)).setUploadParams(SOMEUSER_HASH, "group.docs.1",
                 DocumentClientTool.TYPE_UPLOADEDFILE);

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/access/FinderTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/access/FinderTest.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/access/FinderTest.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -33,7 +33,7 @@
         final Content descriptor = new Content();
         final Container container = TestDomainHelper.createFolderWithIdAndToolName(5, "toolName2");
         descriptor.setContainer(container);
-        Mockito.stub(contentManager.find(1L)).toReturn(descriptor);
+        Mockito.when(contentManager.find(1L)).thenReturn(descriptor);
 
         finder.getContent(new StateToken("groupShortName", "toolName", "5", "1"), null);
     }
@@ -43,7 +43,7 @@
         final Content descriptor = new Content();
         final Container container = TestDomainHelper.createFolderWithIdAndGroupAndTool(5, "groupOther", "toolName");
         descriptor.setContainer(container);
-        Mockito.stub(contentManager.find(1L)).toReturn(descriptor);
+        Mockito.when(contentManager.find(1L)).thenReturn(descriptor);
 
         finder.getContent(new StateToken("groupShortName", "toolName", "5", "1"), null);
     }
@@ -53,7 +53,7 @@
         final Content descriptor = new Content();
         final Container container = TestDomainHelper.createFolderWithId(1);
         descriptor.setContainer(container);
-        Mockito.stub(contentManager.find(1L)).toReturn(descriptor);
+        Mockito.when(contentManager.find(1L)).thenReturn(descriptor);
 
         finder.getContent(new StateToken("groupShortName", "toolName", "5", "1"), null);
     }
@@ -74,7 +74,7 @@
         final Group group = new Group();
         final Content descriptor = new Content();
         group.setDefaultContent(descriptor);
-        Mockito.stub(groupManager.findByShortName("groupShortName")).toReturn(group);
+        Mockito.when(groupManager.findByShortName("groupShortName")).thenReturn(group);
 
         final Content content = finder.getContent(new StateToken("groupShortName", null, null, null), null);
         assertSame(descriptor, content);
@@ -87,7 +87,7 @@
         descriptor.setId(1L);
         descriptor.setContainer(container);
 
-        Mockito.stub(contentManager.find(2L)).toReturn(descriptor);
+        Mockito.when(contentManager.find(2L)).thenReturn(descriptor);
 
         final Content content = finder.getContent(new StateToken("groupShortName", "toolName", "1", "2"), null);
         assertSame(descriptor, content);
@@ -130,7 +130,7 @@
     @Test
     public void testDocMissing() throws Exception {
         final Container container = new Container();
-        Mockito.stub(containerManager.find(1L)).toReturn(container);
+        Mockito.when(containerManager.find(1L)).thenReturn(container);
 
         final Content content = finder.getContent(new StateToken("groupShortName", "toolName", "1", null), null);
         assertNotNull(content);
@@ -142,7 +142,7 @@
         final Group group = new Group();
         final ToolConfiguration config = group.setToolConfig("toolName", new ToolConfiguration());
         final Container container = config.setRoot(new Container());
-        Mockito.stub(groupManager.findByShortName("groupShortName")).toReturn(group);
+        Mockito.when(groupManager.findByShortName("groupShortName")).thenReturn(group);
 
         final StateToken token = new StateToken("groupShortName", "toolName", null, null);
         final Content content = finder.getContent(token, null);
@@ -154,7 +154,7 @@
         final Content descriptor = new Content();
         final Container container = TestDomainHelper.createFolderWithIdAndToolName(5, "toolName");
         descriptor.setContainer(container);
-        Mockito.stub(contentManager.find(1L)).toReturn(descriptor);
+        Mockito.when(contentManager.find(1L)).thenReturn(descriptor);
 
         finder.getContent(new StateToken("groupShortName", "toolName", "5", "1a"), null);
     }

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptorTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptorTest.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptorTest.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -23,59 +23,59 @@
         new IntegrationTestHelper(auth, this);
         invocation = Mockito.mock(MethodInvocation.class);
         final AccessibleObject accessibleObject = Mockito.mock(AccessibleObject.class);
-        Mockito.stub(invocation.getMethod()).toReturn(this.getClass().getMethods()[0]);
-        Mockito.stub(invocation.getStaticPart()).toReturn(accessibleObject);
+        Mockito.when(invocation.getMethod()).thenReturn(this.getClass().getMethods()[0]);
+        Mockito.when(invocation.getStaticPart()).thenReturn(accessibleObject);
         authAnnotation = Mockito.mock(Authenticated.class);
-        Mockito.stub(accessibleObject.getAnnotation(Authenticated.class)).toReturn(authAnnotation);
+        Mockito.when(accessibleObject.getAnnotation(Authenticated.class)).thenReturn(authAnnotation);
     }
 
     @Test(expected = UserMustBeLoggedException.class)
     public void hashNullAndMandatoryMustDoNothing() throws Throwable {
-        Mockito.stub(authAnnotation.mandatory()).toReturn(true);
+        Mockito.when(authAnnotation.mandatory()).thenReturn(true);
         final Object[] arguments = { null };
-        Mockito.stub(invocation.getArguments()).toReturn(arguments);
+        Mockito.when(invocation.getArguments()).thenReturn(arguments);
         auth.invoke(invocation);
     }
 
     @Test
     public void hashNullAndNotMandatoryMustDoNothing() throws Throwable {
-        Mockito.stub(authAnnotation.mandatory()).toReturn(false);
+        Mockito.when(authAnnotation.mandatory()).thenReturn(false);
         final Object[] arguments = { null };
-        Mockito.stub(invocation.getArguments()).toReturn(arguments);
+        Mockito.when(invocation.getArguments()).thenReturn(arguments);
         auth.invoke(invocation);
     }
 
     @Test
     public void hashNullAsStringAndNotMandatoryMustDoNothing() throws Throwable {
-        Mockito.stub(authAnnotation.mandatory()).toReturn(false);
+        Mockito.when(authAnnotation.mandatory()).thenReturn(false);
         final Object[] arguments = { "null" };
-        Mockito.stub(invocation.getArguments()).toReturn(arguments);
+        Mockito.when(invocation.getArguments()).thenReturn(arguments);
         auth.invoke(invocation);
     }
 
     @Test(expected = SessionExpiredException.class)
     public void otherHashAndMandatoryAndLoggedMustSessionExp() throws Throwable {
         doLogin();
-        Mockito.stub(authAnnotation.mandatory()).toReturn(true);
+        Mockito.when(authAnnotation.mandatory()).thenReturn(true);
         final Object[] arguments = { "other-hash" };
-        Mockito.stub(invocation.getArguments()).toReturn(arguments);
+        Mockito.when(invocation.getArguments()).thenReturn(arguments);
         auth.invoke(invocation);
     }
 
     @Test
     public void sameHashAndMandatoryAndLoggedMustSessionExp() throws Throwable {
         doLogin();
-        Mockito.stub(authAnnotation.mandatory()).toReturn(true);
+        Mockito.when(authAnnotation.mandatory()).thenReturn(true);
         final Object[] arguments = { getHash() };
-        Mockito.stub(invocation.getArguments()).toReturn(arguments);
+        Mockito.when(invocation.getArguments()).thenReturn(arguments);
         auth.invoke(invocation);
     }
 
     @Test(expected = SessionExpiredException.class)
     public void someHashAndMandatoryAndNotLoggedMustSessionExp() throws Throwable {
-        Mockito.stub(authAnnotation.mandatory()).toReturn(true);
+        Mockito.when(authAnnotation.mandatory()).thenReturn(true);
         final Object[] arguments = { "some-hash" };
-        Mockito.stub(invocation.getArguments()).toReturn(arguments);
+        Mockito.when(invocation.getArguments()).thenReturn(arguments);
         auth.invoke(invocation);
     }
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptorTest.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -25,37 +25,37 @@
         new IntegrationTestHelper(auth, this);
         invocation = Mockito.mock(MethodInvocation.class);
         final AccessibleObject accessibleObject = Mockito.mock(AccessibleObject.class);
-        Mockito.stub(invocation.getMethod()).toReturn(this.getClass().getMethods()[0]);
-        Mockito.stub(invocation.getStaticPart()).toReturn(accessibleObject);
+        Mockito.when(invocation.getMethod()).thenReturn(this.getClass().getMethods()[0]);
+        Mockito.when(invocation.getStaticPart()).thenReturn(accessibleObject);
         authAnnotation = Mockito.mock(Authorizated.class);
-        Mockito.stub(accessibleObject.getAnnotation(Authorizated.class)).toReturn(authAnnotation);
+        Mockito.when(accessibleObject.getAnnotation(Authorizated.class)).thenReturn(authAnnotation);
 
     }
 
     @Test(expected = ContentNotFoundException.class)
     public void tesHashNullContainer() throws Throwable {
-        // Mockito.stub(authAnnotation.accessRolRequired()).toReturn(AccessRol.Administrator);
-        Mockito.stub(authAnnotation.actionLevel()).toReturn(ActionLevel.content);
+        // Mockito.when(authAnnotation.accessRolRequired()).thenReturn(AccessRol.Administrator);
+        Mockito.when(authAnnotation.actionLevel()).thenReturn(ActionLevel.content);
         final Object[] arguments = { getHash(), new StateToken("group.docs") };
-        Mockito.stub(invocation.getArguments()).toReturn(arguments);
+        Mockito.when(invocation.getArguments()).thenReturn(arguments);
         auth.invoke(invocation);
     }
 
     @Test(expected = ContentNotFoundException.class)
     public void testHashNullContent() throws Throwable {
-        Mockito.stub(authAnnotation.actionLevel()).toReturn(ActionLevel.content);
+        Mockito.when(authAnnotation.actionLevel()).thenReturn(ActionLevel.content);
         final Object[] arguments = { getHash(), new StateToken("group.docs.1") };
-        Mockito.stub(invocation.getArguments()).toReturn(arguments);
+        Mockito.when(invocation.getArguments()).thenReturn(arguments);
         auth.invoke(invocation);
     }
 
     @Test(expected = AccessViolationException.class)
     public void wrongGroupNameThrowsExcep() throws Throwable {
         doLogin();
-        Mockito.stub(authAnnotation.accessRolRequired()).toReturn(AccessRol.Administrator);
-        Mockito.stub(authAnnotation.actionLevel()).toReturn(ActionLevel.content);
+        Mockito.when(authAnnotation.accessRolRequired()).thenReturn(AccessRol.Administrator);
+        Mockito.when(authAnnotation.actionLevel()).thenReturn(ActionLevel.content);
         final Object[] arguments = { getHash(), new StateToken("groupWRONG.docs.1.1") };
-        Mockito.stub(invocation.getArguments()).toReturn(arguments);
+        Mockito.when(invocation.getArguments()).thenReturn(arguments);
         auth.invoke(invocation);
     }
 

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/ContentManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/ContentManagerTest.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/ContentManagerTest.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -96,7 +96,7 @@
     @Test
     public void testUTF8Persist() {
         final Container container = Mockito.mock(Container.class);
-        Mockito.stub(container.getTypeId()).toReturn(DocumentServerTool.TYPE_FOLDER);
+        Mockito.when(container.getTypeId()).thenReturn(DocumentServerTool.TYPE_FOLDER);
         final Content cnt = contentManager.createContent("汉语/漢語", "汉语/漢語", user, container,
                 DocumentServerTool.TYPE_DOCUMENT);
         final Content newCnt = contentManager.find(cnt.getId());
@@ -105,7 +105,7 @@
 
     private void createContentWithMime(final String mimetype) {
         final Container container = Mockito.mock(Container.class);
-        Mockito.stub(container.getTypeId()).toReturn(DocumentServerTool.TYPE_FOLDER);
+        Mockito.when(container.getTypeId()).thenReturn(DocumentServerTool.TYPE_FOLDER);
         final Content cnt = contentManager.createContent("title", "body", user, container,
                 DocumentServerTool.TYPE_UPLOADEDFILE);
         cnt.setMimeType(new BasicMimeType(mimetype));

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManagerTest.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManagerTest.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -47,15 +47,15 @@
         resp = Mockito.mock(HttpServletResponse.class);
         ServletOutputStream oStream = Mockito.mock(ServletOutputStream.class);
 
-        Mockito.stub(resp.getOutputStream()).toReturn(oStream);
+        Mockito.when(resp.getOutputStream()).thenReturn(oStream);
         uploadLocation = kuneProperties.get(KuneProperties.UPLOAD_LOCATION);
 
         fileUtils = Mockito.mock(FileUtils.class);
-        Mockito.stub(fileUtils.exist(Mockito.anyString())).toReturn(true);
+        Mockito.when(fileUtils.exist(Mockito.anyString())).thenReturn(true);
         stateToken = new StateToken("test.test.1.1");
         filename = "somefile";
 
-        Mockito.stub(content.getTitle()).toReturn(SOMETITLE);
+        Mockito.when(content.getTitle()).thenReturn(SOMETITLE);
     }
 
     @Test
@@ -66,7 +66,7 @@
     @Test
     public void testJpgThumbDownload() throws IOException {
         String extension = ".jpg";
-        contentStub(new BasicMimeType("image", "jpg"), filename, extension);
+        contentwhen(new BasicMimeType("image", "jpg"), filename, extension);
         String subExt = ImageSize.thumb.toString();
         String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp, fileUtils);
         assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + extension, absFile);
@@ -80,7 +80,7 @@
     @Test
     public void testPdfDownload1() throws IOException {
         String extension = ".pdf";
-        contentStub(new BasicMimeType("application", "pdf"), filename, extension);
+        contentwhen(new BasicMimeType("application", "pdf"), filename, extension);
         String absFile = fileDownloadManager.buildResponse(content, stateToken, "true", ImageSize.ico.toString(), resp,
                 fileUtils);
         assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + extension, absFile);
@@ -94,7 +94,7 @@
     @Test
     public void testPdfDownload2() throws IOException {
         String pngExtension = ".png";
-        contentStub(new BasicMimeType("application", "pdf"), filename, ".pdf");
+        contentwhen(new BasicMimeType("application", "pdf"), filename, ".pdf");
         String subExt = ImageSize.ico.toString();
         String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp, fileUtils);
         assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + pngExtension, absFile);
@@ -108,7 +108,7 @@
     @Test
     public void testPdfDownload3() throws IOException {
         String pngExtension = ".png";
-        contentStub(new BasicMimeType("application", "pdf"), filename, ".pdf");
+        contentwhen(new BasicMimeType("application", "pdf"), filename, ".pdf");
         String subExt = ImageSize.sized.toString();
         String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp, fileUtils);
         assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + pngExtension, absFile);
@@ -122,7 +122,7 @@
     @Test
     public void testPdfDownload4() throws IOException {
         String pngExtension = ".png";
-        contentStub(new BasicMimeType("application", "pdf"), filename, ".pdf");
+        contentwhen(new BasicMimeType("application", "pdf"), filename, ".pdf");
         String subExt = ImageSize.thumb.toString();
         String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp, fileUtils);
         assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + pngExtension, absFile);
@@ -136,7 +136,7 @@
     @Test
     public void testPdfDownloadNullMime() throws IOException {
         String extension = ".pdf";
-        contentStub(null, filename, extension);
+        contentwhen(null, filename, extension);
         String absFile = fileDownloadManager.buildResponse(content, stateToken, "true", ImageSize.ico.toString(), resp,
                 fileUtils);
         assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + extension, absFile);
@@ -150,7 +150,7 @@
     @Test
     public void testPngDownload1() throws IOException {
         String extension = ".png";
-        contentStub(new BasicMimeType("image", "png"), filename, extension);
+        contentwhen(new BasicMimeType("image", "png"), filename, extension);
         String absFile = fileDownloadManager.buildResponse(content, stateToken, "true", null, resp, fileUtils);
         assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + extension, absFile);
         Mockito.verify(resp).setContentType(FileDownloadManager.APPLICATION_X_DOWNLOAD);
@@ -163,7 +163,7 @@
     @Test
     public void testPngDownload2() throws IOException {
         String extension = ".png";
-        contentStub(new BasicMimeType("image", "png"), filename, extension);
+        contentwhen(new BasicMimeType("image", "png"), filename, extension);
         String subExt = ImageSize.thumb.toString();
         String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp, fileUtils);
         assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + extension, absFile);
@@ -174,8 +174,8 @@
                         + FileDownloadManager.RESP_HEADER_END);
     }
 
-    private void contentStub(BasicMimeType mimeType, String filename, String extension) {
-        Mockito.stub(content.getMimeType()).toReturn(mimeType);
-        Mockito.stub(content.getFilename()).toReturn(filename + extension);
+    private void contentwhen(BasicMimeType mimeType, String filename, String extension) {
+        Mockito.when(content.getMimeType()).thenReturn(mimeType);
+        Mockito.when(content.getFilename()).thenReturn(filename + extension);
     }
 }

Modified: trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -80,7 +80,7 @@
     public void initialEditWithEditionAndSave() {
         presenter.editContent("Text to edit", saveListener, cancelListener);
         String textModified = "Text modified";
-        Mockito.stub(view.getHTML()).toReturn(textModified);
+        Mockito.when(view.getHTML()).thenReturn(textModified);
         presenter.onEdit();
         presenter.onSave();
         assertTrue(saveListener.isCalledWithEquals(textModified));
@@ -99,7 +99,7 @@
     public void testSavePendingAndCancel() {
         presenter.editContent("Text to edit", saveListener, cancelListener);
         String textModified = "Text modified";
-        Mockito.stub(view.getHTML()).toReturn(textModified);
+        Mockito.when(view.getHTML()).thenReturn(textModified);
         presenter.onEdit();
         presenter.onCancel();
         presenter.onCancelConfirmed();
@@ -111,7 +111,7 @@
     public void testSavePendingAndSaveFails() {
         presenter.editContent("Text to edit", saveListener, cancelListener);
         String textModified = "Text modified";
-        Mockito.stub(view.getHTML()).toReturn(textModified);
+        Mockito.when(view.getHTML()).thenReturn(textModified);
         presenter.onEdit();
         presenter.onSave();
         presenter.onSaveFailed();

Modified: trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenterTest.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenterTest.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -34,11 +34,11 @@
     public void onAnotherSelected() {
         licenseWizard.onAnotherLicenseSelecterd();
         Mockito.verify(view).setEnabled(false, true, true, false);
-        Mockito.stub(view.isCurrentPage(firstForm)).toReturn(true);
+        Mockito.when(view.isCurrentPage(firstForm)).thenReturn(true);
         licenseWizard.onNext();
         Mockito.verify(view).show(sndForm);
         Mockito.verify(view).setEnabled(true, true, true, false);
-        Mockito.stub(view.isCurrentPage(sndForm)).toReturn(true);
+        Mockito.when(view.isCurrentPage(sndForm)).thenReturn(true);
         licenseWizard.onBack();
         Mockito.verify(view).show(firstForm);
         Mockito.verify(view).setEnabled(false, true, true, true);

Modified: trunk/src/test/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenterTest.java	2009-01-02 00:58:53 UTC (rev 1020)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenterTest.java	2009-01-02 19:34:01 UTC (rev 1021)
@@ -28,7 +28,7 @@
         final WsThemePresenter theme = Mockito.mock(WsThemePresenter.class);
         final SiteSearcher searcher = Mockito.mock(SiteSearcher.class);
         final Provider searcherProvider = Mockito.mock(Provider.class);
-        Mockito.stub(searcherProvider.get()).toReturn(searcher);
+        Mockito.when(searcherProvider.get()).thenReturn(searcher);
         view = Mockito.mock(TagsSummaryView.class);
         tagsSummaryPresenter = new TagsSummaryPresenter(session, searcherProvider, stateManager, theme);
         tagsSummaryPresenter.init(view);




More information about the kune-commits mailing list