File tree Expand file tree Collapse file tree 1 file changed +2
-19
lines changed
src/test/java/ru/mystamps/web/service Expand file tree Collapse file tree 1 file changed +2
-19
lines changed Original file line number Diff line number Diff line change 17
17
*/
18
18
package ru .mystamps .web .service ;
19
19
20
- import java .util .Date ;
21
-
22
20
import org .junit .Before ;
23
21
import org .junit .Test ;
24
22
import org .junit .runner .RunWith ;
@@ -144,7 +142,7 @@ public void logAboutAbsentPageShouldPassNullToDaoForUnknownUser() {
144
142
145
143
@ Test
146
144
public void logAboutAbsentPageShouldPassUserToDao () {
147
- User user = getUser ();
145
+ User user = TestObjects . createUser ();
148
146
when (suspiciousActivityTypeDao .findByName (anyString ()))
149
147
.thenReturn (TestObjects .createPageNotFoundActivityType ());
150
148
@@ -306,7 +304,7 @@ public void logAboutFailedAuthenticationShouldPassNullToDaoForUnknownUser() {
306
304
307
305
@ Test
308
306
public void logAboutFailedAuthenticationShouldPassUserToDao () {
309
- User user = getUser ();
307
+ User user = TestObjects . createUser ();
310
308
when (suspiciousActivityTypeDao .findByName (anyString ()))
311
309
.thenReturn (TestObjects .createAuthFailedActivityType ());
312
310
@@ -389,19 +387,4 @@ public void logAboutFailedAuthenticationShouldPassEmptyStringToDaoForUnknownUser
389
387
assertThat (activityCaptor .getValue ().getUserAgent ()).isEmpty ();
390
388
}
391
389
392
- private User getUser () {
393
- final Integer anyId = 777 ;
394
- User user = new User ();
395
- user .setId (anyId );
396
- user .setLogin ("test" );
397
- user .setName ("Test Name" );
398
- user .setEmail ("test@example.org" );
399
- user .setRegisteredAt (new Date ());
400
- user .setActivatedAt (new Date ());
401
- user .setHash ("da00ec2e6ff9ed4d342b24a16e262c82f3c8b10b" );
402
- user .setSalt ("salt" );
403
-
404
- return user ;
405
- }
406
-
407
390
}
You can’t perform that action at this time.
0 commit comments