projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add unit test for delete album page
[Sone.git]
/
src
/
test
/
java
/
net
/
pterodactylus
/
sone
/
web
/
WebPageTest.java
diff --git
a/src/test/java/net/pterodactylus/sone/web/WebPageTest.java
b/src/test/java/net/pterodactylus/sone/web/WebPageTest.java
index
9dff571
..
546f001
100644
(file)
--- a/
src/test/java/net/pterodactylus/sone/web/WebPageTest.java
+++ b/
src/test/java/net/pterodactylus/sone/web/WebPageTest.java
@@
-18,6
+18,7
@@
import java.util.Set;
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.core.Preferences;
import net.pterodactylus.sone.core.UpdateChecker;
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.core.Preferences;
import net.pterodactylus.sone.core.UpdateChecker;
+import net.pterodactylus.sone.data.Album;
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.data.SoneOptions.DefaultSoneOptions;
import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.data.SoneOptions.DefaultSoneOptions;
@@
-74,6
+75,8
@@
public abstract class WebPageTest {
return "";
}
});
return "";
}
});
+ when(httpRequest.getParam(anyString())).thenReturn("");
+ when(httpRequest.getParam(anyString(), anyString())).thenReturn("");
}
@Before
}
@Before
@@
-85,6
+88,7
@@
public abstract class WebPageTest {
when(core.getLocalSones()).thenReturn(localSones);
when(core.getSone(anyString())).thenReturn(Optional.<Sone>absent());
when(core.getPost(anyString())).thenReturn(Optional.<Post>absent());
when(core.getLocalSones()).thenReturn(localSones);
when(core.getSone(anyString())).thenReturn(Optional.<Sone>absent());
when(core.getPost(anyString())).thenReturn(Optional.<Post>absent());
+ when(core.getAlbum(anyString())).thenReturn(null);
}
@Before
}
@Before
@@
-126,6
+130,9
@@
public abstract class WebPageTest {
return value.substring(0, Math.min(maxLength, value.length()));
}
});
return value.substring(0, Math.min(maxLength, value.length()));
}
});
+ when(httpRequest.getParam(eq(name))).thenReturn(value);
+ when(httpRequest.getParam(eq(name), anyString())).thenReturn(value);
+ when(httpRequest.isPartSet(eq(name))).thenReturn(value != null && !value.isEmpty());
}
protected void addPost(String postId, Post post) {
}
protected void addPost(String postId, Post post) {
@@
-145,4
+152,8
@@
public abstract class WebPageTest {
ownIdentities.add(ownIdentity);
}
ownIdentities.add(ownIdentity);
}
+ protected void addAlbum(String albumId, Album album) {
+ when(core.getAlbum(eq(albumId))).thenReturn(album);
+ }
+
}
}