<commit_before>package org.jabref.logic.importer.fetcher;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

import org.jabref.logic.bibtex.FieldContentParserPreferences;
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.field.UnknownField;
import org.jabref.model.entry.types.StandardEntryType;
import org.jabref.testutils.category.FetcherTest;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@FetcherTest
public class NewAstrophysicsDataSystemTest {

    private NewAstrophysicsDataSystem fetcher;
    private BibEntry diezSliceTheoremEntry, famaeyMcGaughEntry, sunWelchEntry, xiongSunEntry, ingersollPollardEntry, luceyPaulEntry;

    @BeforeEach
    public void setUp() throws Exception {
        ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class);
        when(importFormatPreferences.getFieldContentParserPreferences()).thenReturn(
                mock(FieldContentParserPreferences.class));
        fetcher = new NewAstrophysicsDataSystem(importFormatPreferences);

        diezSliceTheoremEntry = new BibEntry();
        diezSliceTheoremEntry.setType(StandardEntryType.Article);
        diezSliceTheoremEntry.setCiteKey("2018arXiv181204698D");
        diezSliceTheoremEntry.setField(StandardField.AUTHOR, "<NAME> and <NAME>");
        diezSliceTheoremEntry.setField(StandardField.TITLE, "Slice theorem and orbit type stratification in infinite dimensions");
        diezSliceTheoremEntry.setField(StandardField.YEAR, "2018");
        diezSliceTheoremEntry.setField(StandardField.ARCHIVEPREFIX, "arXiv");
        diezSliceTheoremEntry.setField(StandardField.EPRINT, "1812.04698");
        diezSliceTheoremEntry.setField(StandardField.JOURNAL, "arXiv e-prints");
        diezSliceTheoremEntry.setField(StandardField.KEYWORDS, "Mathematics - Differential Geometry, Mathematical Physics, 58B25, (58D19, 58B20, 22E99, 58A35)");
        diezSliceTheoremEntry.setField(StandardField.MONTH, "Dec");
        diezSliceTheoremEntry.setField(StandardField.PAGES, "arXiv:1812.04698");
        diezSliceTheoremEntry.setField(new UnknownField("eid"), "arXiv:1812.04698");
        diezSliceTheoremEntry.setField(StandardField.PRIMARYCLASS, "math.DG");
        diezSliceTheoremEntry.setField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/2018arXiv181204698D");
        diezSliceTheoremEntry.setField(StandardField.ABSTRACT,
                "We establish a general slice theorem for the action of a locally convex         Lie group on a locally convex manifold, which generalizes the         classical slice theorem of Palais to infinite dimensions. We         discuss two important settings under which the assumptions of         this theorem are fulfilled. First, using Gl{\\\"o}ckner's inverse         function theorem, we show that the linear action of a compact         Lie group on a Fr{\\'e}chet space admits a slice. Second, using         the Nash--Moser theorem, we establish a slice theorem for the         tame action of a tame Fr{\\'e}chet Lie group on a tame         Fr{\\'e}chet manifold. For this purpose, we develop the concept         of a graded Riemannian metric, which allows the construction of         a path-length metric compatible with the manifold topology and         of a local addition. Finally, generalizing a classical result in         finite dimensions, we prove that the existence of a slice         implies that the decomposition of the manifold into orbit types         of the group action is a stratification.");

        famaeyMcGaughEntry = new BibEntry();
        famaeyMcGaughEntry.setType(StandardEntryType.Article);
        famaeyMcGaughEntry.setCiteKey("2012LRR....15...10F");
        famaeyMcGaughEntry.setField(StandardField.AUTHOR, "<NAME>{\\^\\i}t and <NAME>.");
        famaeyMcGaughEntry.setField(StandardField.TITLE, "Modified Newtonian Dynamics (MOND): Observational Phenomenology and Relativistic Extensions");
        famaeyMcGaughEntry.setField(StandardField.JOURNAL, "Living Reviews in Relativity");
        famaeyMcGaughEntry.setField(StandardField.YEAR, "2012");
        famaeyMcGaughEntry.setField(StandardField.VOLUME, "15");
        famaeyMcGaughEntry.setField(StandardField.MONTH, "Sep");
        famaeyMcGaughEntry.setField(StandardField.NUMBER, "1");
        famaeyMcGaughEntry.setField(StandardField.ARCHIVEPREFIX, "arXiv");
        famaeyMcGaughEntry.setField(StandardField.DOI, "10.12942/lrr-2012-10");
        famaeyMcGaughEntry.setField(StandardField.PRIMARYCLASS, "astro-ph.CO");
        famaeyMcGaughEntry.setField(new UnknownField("eid"), "10");
        famaeyMcGaughEntry.setField(StandardField.EPRINT, "1112.3960");
        famaeyMcGaughEntry.setField(StandardField.PAGES, "10");
        famaeyMcGaughEntry.setField(StandardField.KEYWORDS, "astronomical observations, Newtonian limit, equations of motion, extragalactic astronomy, cosmology, theories of gravity, fundamental physics, astrophysics, Astrophysics - Cosmology and Nongalactic Astrophysics, Astrophysics - Astrophysics of Galaxies, General Relativity and Quantum Cosmology, High Energy Physics - Phenomenology, High Energy Physics - Theory");
        famaeyMcGaughEntry.setField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/2012LRR....15...10F");

        sunWelchEntry = new BibEntry();
        sunWelchEntry.setType(StandardEntryType.Article);
        sunWelchEntry.setCiteKey("2012NatMa..11...44S");
        sunWelchEntry.setField(StandardField.AUTHOR, "<NAME> Welch, <NAME>. and <NAME> and <NAME>. and <NAME>. and <NAME>.");
        sunWelchEntry.setField(StandardField.DOI, "10.1038/nmat3160");
        sunWelchEntry.setField(StandardField.JOURNAL, "Nature Materials");
        sunWelchEntry.setField(StandardField.MONTH, "Jan");
        sunWelchEntry.setField(StandardField.NUMBER, "1");
        sunWelchEntry.setField(StandardField.PAGES, "44-48");
        sunWelchEntry.setField(StandardField.TITLE, "Solution-processed small-molecule solar cells with 6.7\\% efficiency");
        sunWelchEntry.setField(StandardField.VOLUME, "11");
        sunWelchEntry.setField(StandardField.YEAR, "2012");
        sunWelchEntry.setField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/2012NatMa..11...44S");

        xiongSunEntry = new BibEntry();
        xiongSunEntry.setType(StandardEntryType.Article);
        xiongSunEntry.setCiteKey("2007ITGRS..45..879X");
        xiongSunEntry.setField(StandardField.AUTHOR, "<NAME> <NAME> <NAME> and <NAME>");
        xiongSunEntry.setField(StandardField.DOI, "10.1109/TGRS.2006.890567");
        xiongSunEntry.setField(StandardField.JOURNAL, "IEEE Transactions on Geoscience and Remote Sensing");
        xiongSunEntry.setField(StandardField.MONTH, "Apr");
        xiongSunEntry.setField(StandardField.NUMBER, "4");
        xiongSunEntry.setField(StandardField.PAGES, "879-889");
        xiongSunEntry.setField(StandardField.TITLE, "Multiyear On-Orbit Calibration and Performance of Terra MODIS Reflective Solar Bands");
        xiongSunEntry.setField(StandardField.VOLUME, "45");
        xiongSunEntry.setField(StandardField.YEAR, "2007");
        xiongSunEntry.setField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/2007ITGRS..45..879X");

        ingersollPollardEntry = new BibEntry();
        ingersollPollardEntry.setType(StandardEntryType.Article);
        ingersollPollardEntry.setCiteKey("1982Icar...52...62I");
        ingersollPollardEntry.setField(StandardField.ABSTRACT, "If Jupiter's and Saturn's fluid interiors were inviscid and adiabatic,         any steady zonal motion would take the form of differentially         rotating cylinders concentric about the planetary axis of         rotation. <NAME> et al. [ Science215, 504-537 (1982)]         showed that Saturn's observed zonal wind profile extends a         significant distance below cloud base. Further extension into         the interior occurs if the values of the eddy viscosity and         superadiabaticity are small. We estimate these values using a         scaling analysis of deep convection in the presence of         differential rotation. The differential rotation inhibits the         convection and reduces the effective eddy viscosity. Viscous         dissipation of zonal mean kinetic energy is then within the         bounds set by the internal heat source. The differential         rotation increases the superadiabaticity, but not so much as to         eliminate the cylindrical structure of the flow. Very large         departures from adiabaticity, necessary for decoupling the         atmosphere and interior, do not occur. Using our scaling         analysis we develop the anelastic equations that describe         motions in Jupiter's and Saturn's interiors. A simple problem is         solved, that of an adiabatic fluid with a steady zonal wind         varying as a function of cylindrical radius. Low zonal         wavenumber perturbations are two dimensional (independent of the         axial coordinate) and obey a modified barotropic stability         equation. The parameter analogous to {\\ensuremath{\\beta}} is         negative and is three to four times larger than the         {\\ensuremath{\\beta}} for thin atmospheres. Jupiter's and         Saturn's observed zonal wind profiles are close to marginal         stability according to this deep sphere criterion, but are         several times supercritical according to the thin atmosphere         criterion.");
        ingersollPollardEntry.setField(StandardField.AUTHOR, "<NAME>. and <NAME>.");
        ingersollPollardEntry.setField(StandardField.DOI, "10.1016/0019-1035(82)90169-5");
        ingersollPollardEntry.setField(StandardField.JOURNAL, "\\icarus");
        ingersollPollardEntry.setField(StandardField.KEYWORDS, "Atmospheric Circulation, Barotropic Flow, Convective Flow, Flow Stability, Jupiter Atmosphere, Rotating Fluids, Saturn Atmosphere, Adiabatic Flow, Anelasticity, Compressible Fluids, Planetary Rotation, Rotating Cylinders, Scaling Laws, Wind Profiles, PLANETS, JUPITER, SATURN, MOTION, INTERIORS, ATMOSPHERE, ANALYSIS, SCALE, BAROTROPY, CHARACTERISTICS, STRUCTURE, WINDS, VISCOSITY, DATA, CONVECTION, ROTATION, EDDY EFFECTS, ENERGY, ADIABATICITY, DIAGRAMS, REVIEW, LATITUDE, ZONES, VELOCITY, MATHEMATICAL MODELS, HEAT FLOW, EQUATIONS OF MOTION, FLUIDS, DYNAMICS, TEMPERATURE, GRADIENTS, Lunar and Planetary Exploration; Planets");
        ingersollPollardEntry.setField(StandardField.MONTH, "Oct");
        ingersollPollardEntry.setField(StandardField.NUMBER, "1");
        ingersollPollardEntry.setField(StandardField.PAGES, "62-80");
        ingersollPollardEntry.setField(StandardField.TITLE, "Motion in the interiors and atmospheres of Jupiter and Saturn: scale analysis, anelastic equations, barotropic stability criterion");
        ingersollPollardEntry.setField(StandardField.VOLUME, "52");
        ingersollPollardEntry.setField(StandardField.YEAR, "1982");
        ingersollPollardEntry.setField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/1982Icar...52...62I");

        luceyPaulEntry = new BibEntry();
        luceyPaulEntry.setType(StandardEntryType.Article);
        luceyPaulEntry.setCiteKey("2000JGR...10520297L");
        luceyPaulEntry.setField(StandardField.AUTHOR, "<NAME>. and Blewett, <NAME>. and <NAME>.");
        luceyPaulEntry.setField(StandardField.DOI, "10.1029/1999JE001117");
        luceyPaulEntry.setField(StandardField.JOURNAL, "\\jgr");
        luceyPaulEntry.setField(StandardField.KEYWORDS, "Planetology: Solid Surface Planets: Composition, Planetology: Solid Surface Planets: Remote sensing, Planetology: Solid Surface Planets: Surface materials and properties, Planetology: Solar System Objects: Moon (1221)");
        luceyPaulEntry.setField(StandardField.PAGES, "20297-20306");
        luceyPaulEntry.setField(StandardField.TITLE, "Lunar iron and titanium abundance algorithms based on final processing of Clementine ultraviolet-visible images");
        luceyPaulEntry.setField(StandardField.VOLUME, "105");
        luceyPaulEntry.setField(StandardField.YEAR, "2000");
        luceyPaulEntry.setField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/2000JGR...10520297L");
        luceyPaulEntry.setField(StandardField.MONTH, "Jan");
        luceyPaulEntry.setField(StandardField.NUMBER, "E8");
    }

    @Test
    public void testHelpPage() {
        assertEquals("ADS", fetcher.getHelpPage().get().getPageName());
    }

    @Test
    public void testGetName() {
        assertEquals("New SAO/NASA Astrophysics Data System", fetcher.getName());
    }

    @Test
    public void searchByQueryFindsEntry() throws Exception {
        List<BibEntry> fetchedEntries = fetcher.performSearch("Diez slice theorem Lie");
        assertEquals(Collections.singletonList(diezSliceTheoremEntry), fetchedEntries);
    }

    @Test
    public void searchByEntryFindsEntry() throws Exception {
        BibEntry searchEntry = new BibEntry();
        searchEntry.setField(StandardField.TITLE, "slice theorem");
        searchEntry.setField(StandardField.AUTHOR, "Diez");

        List<BibEntry> fetchedEntries = fetcher.performSearch(searchEntry);
        assertFalse(fetchedEntries.isEmpty());
        assertEquals(diezSliceTheoremEntry, fetchedEntries.get(0));
    }

    @Test
    public void testPerformSearchByFamaeyMcGaughEntry() throws Exception {
        Optional<BibEntry> fetchedEntry = fetcher.performSearchById("10.12942/lrr-2012-10");
        fetchedEntry.ifPresent(entry -> entry.clearField(StandardField.ABSTRACT));//Remove abstract due to copyright
        assertEquals(famaeyMcGaughEntry, fetchedEntry.get());
    }

    @Test
    public void testPerformSearchByIdEmptyDOI() throws Exception {
        Optional<BibEntry> fetchedEntry = fetcher.performSearchById("");
        assertEquals(Optional.empty(), fetchedEntry);
    }

    @Test
    public void testPerformSearchByIdInvalidDoi() throws Exception {
        assertEquals(Optional.empty(), fetcher.performSearchById("this.doi.will.fail"));
    }

    @Test
    public void testPerformSearchBySunWelchEntry() throws Exception {
        Optional<BibEntry> fetchedEntry = fetcher.performSearchById("10.1038/nmat3160");
        fetchedEntry.ifPresent(entry -> entry.clearField(StandardField.ABSTRACT)); //Remove abstract due to copyright
        assertEquals(Optional.of(sunWelchEntry), fetchedEntry);
    }
<commit_msg>fixed bug where equals doesnt work with unknown field<commit_after>package org.jabref.logic.importer.fetcher;

import java.util.List;
import java.util.Optional;

import org.jabref.logic.bibtex.FieldContentParserPreferences;
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.types.StandardEntryType;
import org.jabref.testutils.category.FetcherTest;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@FetcherTest
public class NewAstrophysicsDataSystemTest {

    private NewAstrophysicsDataSystem fetcher;
    private BibEntry diezSliceTheoremEntry, famaeyMcGaughEntry, sunWelchEntry, xiongSunEntry, ingersollPollardEntry, luceyPaulEntry;

    @BeforeEach
    public void setUp() throws Exception {
        ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class);
        when(importFormatPreferences.getFieldContentParserPreferences()).thenReturn(
                mock(FieldContentParserPreferences.class));
        fetcher = new NewAstrophysicsDataSystem(importFormatPreferences);

        diezSliceTheoremEntry = new BibEntry();
        diezSliceTheoremEntry.setType(StandardEntryType.Article);
        diezSliceTheoremEntry.setCiteKey("<KEY>");
        diezSliceTheoremEntry.setField(StandardField.AUTHOR, "<NAME> and <NAME>");
        diezSliceTheoremEntry.setField(StandardField.TITLE, "Slice theorem and orbit type stratification in infinite dimensions");
        diezSliceTheoremEntry.setField(StandardField.YEAR, "2018");
        diezSliceTheoremEntry.setField(StandardField.ARCHIVEPREFIX, "arXiv");
        diezSliceTheoremEntry.setField(StandardField.EPRINT, "1812.04698");
        diezSliceTheoremEntry.setField(StandardField.JOURNAL, "arXiv e-prints");
        diezSliceTheoremEntry.setField(StandardField.KEYWORDS, "Mathematics - Differential Geometry, Mathematical Physics, 58B25, (58D19, 58B20, 22E99, 58A35)");
        diezSliceTheoremEntry.setField(StandardField.MONTH, "Dec");
        diezSliceTheoremEntry.setField(StandardField.PAGES, "arXiv:1812.04698");
        diezSliceTheoremEntry.setField(StandardField.EID, "arXiv:1812.04698");
        diezSliceTheoremEntry.setField(StandardField.PRIMARYCLASS, "math.DG");
        diezSliceTheoremEntry.setField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/2018arXiv181204698D");
        diezSliceTheoremEntry.setField(StandardField.ABSTRACT,
                "We establish a general slice theorem for the action of a locally convex         Lie group on a locally convex manifold, which generalizes the         classical slice theorem of Palais to infinite dimensions. We         discuss two important settings under which the assumptions of         this theorem are fulfilled. First, using Gl{\\\"o}ckner's inverse         function theorem, we show that the linear action of a compact         Lie group on a Fr{\\'e}chet space admits a slice. Second, using         the Nash--Moser theorem, we establish a slice theorem for the         tame action of a tame Fr{\\'e}chet Lie group on a tame         Fr{\\'e}chet manifold. For this purpose, we develop the concept         of a graded Riemannian metric, which allows the construction of         a path-length metric compatible with the manifold topology and         of a local addition. Finally, generalizing a classical result in         finite dimensions, we prove that the existence of a slice         implies that the decomposition of the manifold into orbit types         of the group action is a stratification.");

        famaeyMcGaughEntry = new BibEntry();
        famaeyMcGaughEntry.setType(StandardEntryType.Article);
        famaeyMcGaughEntry.setCiteKey("2012LRR....15...10F");
        famaeyMcGaughEntry.setField(StandardField.AUTHOR, "<NAME>{\\^\\i}<NAME> <NAME>.");
        famaeyMcGaughEntry.setField(StandardField.TITLE, "Modified Newtonian Dynamics (MOND): Observational Phenomenology and Relativistic Extensions");
        famaeyMcGaughEntry.setField(StandardField.JOURNAL, "Living Reviews in Relativity");
        famaeyMcGaughEntry.setField(StandardField.YEAR, "2012");
        famaeyMcGaughEntry.setField(StandardField.VOLUME, "15");
        famaeyMcGaughEntry.setField(StandardField.MONTH, "Sep");
        famaeyMcGaughEntry.setField(StandardField.NUMBER, "1");
        famaeyMcGaughEntry.setField(StandardField.ARCHIVEPREFIX, "arXiv");
        famaeyMcGaughEntry.setField(StandardField.DOI, "10.12942/lrr-2012-10");
        famaeyMcGaughEntry.setField(StandardField.PRIMARYCLASS, "astro-ph.CO");
        famaeyMcGaughEntry.setField(StandardField.EID, "10");
        famaeyMcGaughEntry.setField(StandardField.EPRINT, "1112.3960");
        famaeyMcGaughEntry.setField(StandardField.PAGES, "10");
        famaeyMcGaughEntry.setField(StandardField.KEYWORDS, "astronomical observations, Newtonian limit, equations of motion, extragalactic astronomy, cosmology, theories of gravity, fundamental physics, astrophysics, Astrophysics - Cosmology and Nongalactic Astrophysics, Astrophysics - Astrophysics of Galaxies, General Relativity and Quantum Cosmology, High Energy Physics - Phenomenology, High Energy Physics - Theory");
        famaeyMcGaughEntry.setField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/2012LRR....15...10F");

        sunWelchEntry = new BibEntry();
        sunWelchEntry.setType(StandardEntryType.Article);
        sunWelchEntry.setCiteKey("2012NatMa..11...44S");
        sunWelchEntry.setField(StandardField.AUTHOR, "<NAME> Welch, <NAME>. and <NAME> and <NAME>. and <NAME>. and <NAME>.");
        sunWelchEntry.setField(StandardField.DOI, "10.1038/nmat3160");
        sunWelchEntry.setField(StandardField.JOURNAL, "Nature Materials");
        sunWelchEntry.setField(StandardField.MONTH, "Jan");
        sunWelchEntry.setField(StandardField.NUMBER, "1");
        sunWelchEntry.setField(StandardField.PAGES, "44-48");
        sunWelchEntry.setField(StandardField.TITLE, "Solution-processed small-molecule solar cells with 6.7\\% efficiency");
        sunWelchEntry.setField(StandardField.VOLUME, "11");
        sunWelchEntry.setField(StandardField.YEAR, "2012");
        sunWelchEntry.setField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/2012NatMa..11...44S");

        xiongSunEntry = new BibEntry();
        xiongSunEntry.setType(StandardEntryType.Article);
        xiongSunEntry.setCiteKey("2007ITGRS..45..879X");
        xiongSunEntry.setField(StandardField.AUTHOR, "<NAME> <NAME> <NAME>");
        xiongSunEntry.setField(StandardField.DOI, "10.1109/TGRS.2006.890567");
        xiongSunEntry.setField(StandardField.JOURNAL, "IEEE Transactions on Geoscience and Remote Sensing");
        xiongSunEntry.setField(StandardField.MONTH, "Apr");
        xiongSunEntry.setField(StandardField.NUMBER, "4");
        xiongSunEntry.setField(StandardField.PAGES, "879-889");
        xiongSunEntry.setField(StandardField.TITLE, "Multiyear On-Orbit Calibration and Performance of Terra MODIS Reflective Solar Bands");
        xiongSunEntry.setField(StandardField.VOLUME, "45");
        xiongSunEntry.setField(StandardField.YEAR, "2007");
        xiongSunEntry.setField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/2007ITGRS..45..879X");

        ingersollPollardEntry = new BibEntry();
        ingersollPollardEntry.setType(StandardEntryType.Article);
        ingersollPollardEntry.setCiteKey("1982Icar...52...62I");
        ingersollPollardEntry.setField(StandardField.ABSTRACT, "If Jupiter's and Saturn's fluid interiors were inviscid and adiabatic,         any steady zonal motion would take the form of differentially         rotating cylinders concentric about the planetary axis of         rotation. <NAME> et al. [ Science215, 504-537 (1982)]         showed that Saturn's observed zonal wind profile extends a         significant distance below cloud base. Further extension into         the interior occurs if the values of the eddy viscosity and         superadiabaticity are small. We estimate these values using a         scaling analysis of deep convection in the presence of         differential rotation. The differential rotation inhibits the         convection and reduces the effective eddy viscosity. Viscous         dissipation of zonal mean kinetic energy is then within the         bounds set by the internal heat source. The differential         rotation increases the superadiabaticity, but not so much as to         eliminate the cylindrical structure of the flow. Very large         departures from adiabaticity, necessary for decoupling the         atmosphere and interior, do not occur. Using our scaling         analysis we develop the anelastic equations that describe         motions in Jupiter's and Saturn's interiors. A simple problem is         solved, that of an adiabatic fluid with a steady zonal wind         varying as a function of cylindrical radius. Low zonal         wavenumber perturbations are two dimensional (independent of the         axial coordinate) and obey a modified barotropic stability         equation. The parameter analogous to {\\ensuremath{\\beta}} is         negative and is three to four times larger than the         {\\ensuremath{\\beta}} for thin atmospheres. Jupiter's and         Saturn's observed zonal wind profiles are close to marginal         stability according to this deep sphere criterion, but are         several times supercritical according to the thin atmosphere         criterion.");
        ingersollPollardEntry.setField(StandardField.AUTHOR, "<NAME>. and <NAME>.");
        ingersollPollardEntry.setField(StandardField.DOI, "10.1016/0019-1035(82)90169-5");
        ingersollPollardEntry.setField(StandardField.JOURNAL, "\\icarus");
        ingersollPollardEntry.setField(StandardField.KEYWORDS, "Atmospheric Circulation, Barotropic Flow, Convective Flow, Flow Stability, Jupiter Atmosphere, Rotating Fluids, Saturn Atmosphere, Adiabatic Flow, Anelasticity, Compressible Fluids, Planetary Rotation, Rotating Cylinders, Scaling Laws, Wind Profiles, PLANETS, JUPITER, SATURN, MOTION, INTERIORS, ATMOSPHERE, ANALYSIS, SCALE, BAROTROPY, CHARACTERISTICS, STRUCTURE, WINDS, VISCOSITY, DATA, CONVECTION, ROTATION, EDDY EFFECTS, ENERGY, ADIABATICITY, DIAGRAMS, REVIEW, LATITUDE, ZONES, VELOCITY, MATHEMATICAL MODELS, HEAT FLOW, EQUATIONS OF MOTION, FLUIDS, DYNAMICS, TEMPERATURE, GRADIENTS, Lunar and Planetary Exploration; Planets");
        ingersollPollardEntry.setField(StandardField.MONTH, "Oct");
        ingersollPollardEntry.setField(StandardField.NUMBER, "1");
        ingersollPollardEntry.setField(StandardField.PAGES, "62-80");
        ingersollPollardEntry.setField(StandardField.TITLE, "Motion in the interiors and atmospheres of Jupiter and Saturn: scale analysis, anelastic equations, barotropic stability criterion");
        ingersollPollardEntry.setField(StandardField.VOLUME, "52");
        ingersollPollardEntry.setField(StandardField.YEAR, "1982");
        ingersollPollardEntry.setField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/1982Icar...52...62I");

        luceyPaulEntry = new BibEntry();
        luceyPaulEntry.setType(StandardEntryType.Article);
        luceyPaulEntry.setCiteKey("2000JGR...10520297L");
        luceyPaulEntry.setField(StandardField.AUTHOR, "<NAME>. and <NAME>. and <NAME>.");
        luceyPaulEntry.setField(StandardField.DOI, "10.1029/1999JE001117");
        luceyPaulEntry.setField(StandardField.JOURNAL, "\\jgr");
        luceyPaulEntry.setField(StandardField.KEYWORDS, "Planetology: Solid Surface Planets: Composition, Planetology: Solid Surface Planets: Remote sensing, Planetology: Solid Surface Planets: Surface materials and properties, Planetology: Solar System Objects: Moon (1221)");
        luceyPaulEntry.setField(StandardField.PAGES, "20297-20306");
        luceyPaulEntry.setField(StandardField.TITLE, "Lunar iron and titanium abundance algorithms based on final processing of Clementine ultraviolet-visible images");
        luceyPaulEntry.setField(StandardField.VOLUME, "105");
        luceyPaulEntry.setField(StandardField.YEAR, "2000");
        luceyPaulEntry.setField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/2000JGR...10520297L");
        luceyPaulEntry.setField(StandardField.MONTH, "Jan");
        luceyPaulEntry.setField(StandardField.NUMBER, "E8");
    }

    @Test
    public void testHelpPage() {
        assertEquals("ADS", fetcher.getHelpPage().get().getPageName());
    }

    @Test
    public void testGetName() {
        assertEquals("New SAO/NASA Astrophysics Data System", fetcher.getName());
    }

    @Test
    public void searchByQueryFindsEntry() throws Exception {
        List<BibEntry> fetchedEntries = fetcher.performSearch("Diez slice theorem Lie");
        assertTrue(fetchedEntries.contains(diezSliceTheoremEntry));
    }

    @Test
    public void searchByEntryFindsEntry() throws Exception {
        BibEntry searchEntry = new BibEntry();
        searchEntry.setField(StandardField.TITLE, "slice theorem");
        searchEntry.setField(StandardField.AUTHOR, "Diez");

        List<BibEntry> fetchedEntries = fetcher.performSearch(searchEntry);
        assertFalse(fetchedEntries.isEmpty());
        assertEquals(diezSliceTheoremEntry, fetchedEntries.get(0));
    }

    @Test
    public void testPerformSearchByFamaeyMcGaughEntry() throws Exception {
        Optional<BibEntry> fetchedEntry = fetcher.performSearchById("10.12942/lrr-2012-10");
        fetchedEntry.ifPresent(entry -> entry.clearField(StandardField.ABSTRACT));//Remove abstract due to copyright
        assertEquals(Optional.of(famaeyMcGaughEntry), fetchedEntry);
    }

    @Test
    public void testPerformSearchByIdEmptyDOI() throws Exception {
        Optional<BibEntry> fetchedEntry = fetcher.performSearchById("");
        assertEquals(Optional.empty(), fetchedEntry);
    }

    @Test
    public void testPerformSearchByIdInvalidDoi() throws Exception {
        assertEquals(Optional.empty(), fetcher.performSearchById("this.doi.will.fail"));
    }

    @Test
    public void testPerformSearchBySunWelchEntry() throws Exception {
        Optional<BibEntry> fetchedEntry = fetcher.performSearchById("10.1038/nmat3160");
        fetchedEntry.ifPresent(entry -> entry.clearField(StandardField.ABSTRACT)); //Remove abstract due to copyright
        assertEquals(Optional.of(sunWelchEntry), fetchedEntry);
    }

{'fraction_non_alphanumeric': 0.09345381662533546, 'fraction_numerical': 0.02394945137072392, 'mean_word_length': 4.072893331035671, 'pattern_counts': {'":': 0, '<': 54, '<?xml version=': 0, '>': 58, 'https://': 12, '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': '2773475', 'n_tokens_mistral': 9214, 'n_tokens_neox': 8286, 'n_words': 1978}