forked from comixed/comixed
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ComicRackBackupAdaptorTest.java
65 lines (55 loc) · 2.19 KB
/
ComicRackBackupAdaptorTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* ComiXed - A digital comic book library management application.
* Copyright (C) 2019, The ComiXed Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses>
*/
package org.comixed.importer.adaptors;
import static org.junit.Assert.*;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.comixed.model.library.Comic;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.boot.test.context.SpringBootTest;
@RunWith(MockitoJUnitRunner.class)
@SpringBootTest
public class ComicRackBackupAdaptorTest {
private static final File TEST_COMICRACK_BACKUP_FILE =
new File("src/test/resources/comicrack-backup.xml");
private static final Map<String, String> CURRENT_PAGES = new HashMap<>();
@InjectMocks private ComicRackBackupAdaptor adaptor;
@Test
public void testLoadLoadsComics() throws ImportAdaptorException {
List<Comic> result =
this.adaptor.load(TEST_COMICRACK_BACKUP_FILE, CURRENT_PAGES, new HashMap<>());
assertNotNull(result);
assertFalse(result.isEmpty());
assertEquals(8, result.size());
}
@Test
public void testLoadLoadsLists() throws ImportAdaptorException {
Map<String, String> guids = new HashMap<>();
this.adaptor.load(TEST_COMICRACK_BACKUP_FILE, CURRENT_PAGES, guids);
Map<String, List> result = this.adaptor.loadLists(TEST_COMICRACK_BACKUP_FILE, guids);
assertNotNull(result);
assertFalse(result.isEmpty());
assertEquals(1, result.size());
assertEquals(2, result.get("Manual").size());
}
}