<commit_before>package com.twu.biblioteca.controller;

import org.junit.Test;

import static org.junit.Assert.*;


public class LibraryTest {

    @Test
    public void testName() {
        assertEquals(true, true);
    }
}<commit_msg>|#0044| Added new specs for the Library<commit_after>package com.twu.biblioteca.controller;

import com.twu.biblioteca.model.Book;
import com.twu.biblioteca.model.LibraryItem;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.*;


public class LibraryTest {

    @Test
    public void shouldReturnListOfAvailableItems() {
        List<LibraryItem> availableItems = new ArrayList<LibraryItem>();
        List<LibraryItem> checkedOutItem = new ArrayList<LibraryItem>();
        availableItems.add(new Book("My Book", "Rajat", "2012"));
        Library library = new Library(availableItems, checkedOutItem);

        assertEquals(1, library.listAvailableItems().size());
    }

    @Test
    public void shouldReturnListOfCheckedOutItems() {
        List<LibraryItem> availableItems = new ArrayList<LibraryItem>();
        List<LibraryItem> checkedOutItem = new ArrayList<LibraryItem>();
        availableItems.add(new Book("My Book", "Rajat", "2012"));
        Library library = new Library(availableItems, checkedOutItem);

        library.performCheckOut("my book");

        assertEquals(1, library.listCheckedOutItems().size());
    }

    @Test
    public void shouldBeAbleToPerformCheckOut() {
        List<LibraryItem> availableItems = new ArrayList<LibraryItem>();
        List<LibraryItem> checkedOutItem = new ArrayList<LibraryItem>();
        availableItems.add(new Book("My Book", "Rajat", "2012"));
        Library library = new Library(availableItems, checkedOutItem);

        assertEquals(true, library.performCheckOut("my book"));
    }

    @Test
    public  void shouldBeAbleToReturnBook() {
        List<LibraryItem> availableItems = new ArrayList<LibraryItem>();
        List<LibraryItem> checkedOutItem = new ArrayList<LibraryItem>();
        availableItems.add(new Book("My Book", "Rajat", "2012"));
        Library library = new Library(availableItems, checkedOutItem);

        library.performCheckOut("my book");

        assertEquals(true, library.performReturn("my book"));
    }

    @Test
    public  void shouldBeAbleToNotReturnBookIfNotCheckedOut() {
        List<LibraryItem> availableItems = new ArrayList<LibraryItem>();
        List<LibraryItem> checkedOutItem = new ArrayList<LibraryItem>();
        availableItems.add(new Book("My Book", "Rajat", "2012"));
        Library library = new Library(availableItems, checkedOutItem);

        assertEquals(false, library.performReturn("my book"));
    }
}
{'fraction_non_alphanumeric': 0.11771177117711772, 'fraction_numerical': 0.009534286762009535, 'mean_word_length': 3.8801431127012522, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3396124', 'n_tokens_mistral': 763, 'n_tokens_neox': 726, 'n_words': 167}