package com.nicusa.util; import org.junit.Test; import java.io.IOException; import java.util.Set; import static org.hamcrest.Matchers.is; import static org.junit.Assert.*; public class FieldFinderTest { @Test public void findsUniis ( ) throws IOException { String containsUniis = "{ \"meta\": { \"disclaimer\": \"openFDA is a beta research project and not for clinical use. While we make every effort to ensure that data is accurate, you should assume all results are unvalidated.\", \"license\": \"http://open.fda.gov/license\", \"last_updated\": \"2015-05-31\", \"results\": { \"skip\": 0, \"limit\": 2, \"total\": 459 } }, \"results\": [ { \"set_id\": \"0025eb89-590c-4451-8a06-b129686cf75a\", \"indications_and_usage\": [ \"Uses temporarily relieves minor aches and pains other therapy as recommended by your doctor. Because of its delayed action, this product will not provide fast relief of headaches, fever, or other symptoms needing immediate relief.\" ], \"other_safety_information\": [ \"Other information store at controlled room temperature 15\u00B0-30\u00B0C (59\u00B0-86\u00B0F) do not use if imprinted safety seal under cap is broken or missing\" ], \"stop_use\": [ \"Stop use and ask a doctor if you experience any of the following signs of stomach bleeding: feel faint vomit blood have bloody or black stools have stomach pain that does not get better allergic reaction occurs ringing in the ears or a loss of hearing occurs pain gets worse or lasts more than 10 days fever gets worse or lasts more than 3 days any new symptoms appear redness or swelling is present in the painful area\" ], \"keep_out_of_reach_of_children\": [ \"Keep out of reach of children In case of overdose, get medical help or contact a Poison Control Center right away.\" ], \"ask_doctor\": [ \"Ask a doctor before use if stomach bleeding warning applies to you you have a history of stomach problems, such as heartburn you have high blood pressure, heart disease, liver cirrhosis, or kidney disease you are taking a diuretic you have asthma\" ], \"questions\": [ \"Questions or comments? Call toll free 1-877-753-3935\" ], \"dosage_and_administration\": [ \"Directions do not exceed recommended dosage drink a full glass of water with each dose adults and children 12 years of age and over: take 4 to 8 tablets every 4 hours not to exceed 48 tablets in 24 hours, unless directed by a doctor children under 12 years of age: consult a doctor\" ], \"purpose\": [ \"Purpose Pain reliever\" ], \"ask_doctor_or_pharmacist\": [ \"Ask a doctor or pharmacist before use if you are taking a prescription drug for: anticoagulation (thinning of the blood) gout diabetes arthritis\" ], \"do_not_use\": [ \"Do not use if you have ever had an allergic reaction to any other pain reliever/fever reducer\" ], \"version\": \"2\", \"id\": \"8244057c-8522-4871-8576-a15b9583cbb7\", \"package_label_principal_display_panel\": [ \"Principal Display Panel Compare to the active ingredient in ASPIRIN REGIMEN BAYER\u00AE 81 mg** SEE NEW WARNINGS INFORMATION Low Dose 81 mg ASPIRIN adult low strength Pain reliever (NSAID)* KEEP OUTER CARTON FOR COMPLETE WARNINGS AND PRODUCT INFORMATION **This product is not manufactured or distributedby Bayer Corporation Consumer care division, owner of the registered trademark Aspirin Regimen Bayer\u00AE 81 mg\", \"Product Label Enteric coated Aspirin 81 mg Valu merchandisers Best Choice\" ], \"pregnancy_or_breast_feeding\": [ \"If pregnant or breast- feeding, ask a health professional before use. It is especially important not to use aspirin during the last 3 months of pregnancy unless definitely directed to do so by a doctor because it may cause problems in the unborn child or complications during delivery.\" ], \"active_ingredient\": [ \"Active ingredient (in each tablet) Aspirin 81 mg (NSAID)* *nonsteroidal anti- inflammatory drug\" ], \"inactive_ingredient\": [ \"Inactive ingredients *acetylated monoglycerides, *anhydrous lactose, *carnauba wax, colloidal silicon dioxide,*corn starch, *croscarmellose sodium, D&C Yellow #10 Aluminum Lake, FD&C Yellow #6 Aluminum Lake, hypromellose, *hypromellose phthalate, *iron oxide Yellow (iron oxide ochre), methacrylic acid copolymer, microcrystalline cellulose, *mineral oil, *polyethylene glycol (PEG)-400, *polysorbate 80, povidone, pregelatinized starch, *propylene glycol, *simethicone, silicon dioxide, sodium bicarbonate, sodium hydroxide, sodium lauryl sulfate, starch, stearic acid, talc, titanium dioxide, triacetin, and triethyl citrate. *May also contain.\" ], \"@epoch\": 1416451272.131902, \"effective_time\": \"20121114\", \"openfda\": { \"unii\": [ \"R16CO5Y76E\" ], \"spl_id\": [ \"8244057c-8522-4871-8576-a15b9583cbb7\" ], \"product_ndc\": [ \"63941-440\" ], \"substance_name\": [ \"ASPIRIN\" ], \"rxcui\": [ \"308416\" ], \"spl_set_id\": [ \"0025eb89-590c-4451-8a06-b129686cf75a\" ], \"product_type\": [ \"HUMAN OTC DRUG\" ], \"pharm_class_cs\": [ \"Nonsteroidal Anti-inflammatory Compounds [Chemical/Ingredient]\" ], \"manufacturer_name\": [ \"Valu Merchandisers Company (Best Choice)\" ], \"brand_name\": [ \"Aspirin Adult low strength\" ], \"pharm_class_pe\": [ \"Decreased Prostaglandin Production [PE]\" ], \"is_original_packager\": [ true ], \"route\": [ \"ORAL\" ], \"nui\": [ \"N0000000160\", \"N0000175721\", \"N0000008836\", \"N0000175722\" ], \"pharm_class_moa\": [ \"Cyclooxygenase Inhibitors [MoA]\" ], \"package_ndc\": [ \"63941-440-12\" ], \"pharm_class_epc\": [ \"Nonsteroidal Anti-inflammatory Drug [EPC]\" ], \"generic_name\": [ \"ASPIRIN\" ], \"application_number\": [ \"part343\" ] }, \"spl_product_data_elements\": [ \"AspirinAdult low strength Aspirin ASPIRIN ASPIRIN DIACETYLATED MONOGLYCERIDES ANHYDROUS LACTOSE CARNAUBA WAX SILICON DIOXIDE STARCH, CORN CROSCARMELLOSE SODIUM D&C YELLOW NO. 10 HYPROMELLOSES HYPROMELLOSE PHTHALATE (24% PHTHALATE, 55 CST) FERRIC OXIDE YELLOW METHACRYLIC ACID - METHYL METHACRYLATE COPOLYMER (1:1) CELLULOSE, MICROCRYSTALLINE MINERAL OIL POLYETHYLENE GLYCOL 400 POLYSORBATE 80 POVIDONES STARCH, CORN PROPYLENE GLYCOL DIMETHICONE SILICON DIOXIDE SODIUM BICARBONATE SODIUM HYDROXIDE SODIUM LAURYL SULFATE STARCH, CORN STEARIC ACID TALC TITANIUM DIOXIDE TRIACETIN TRIETHYL CITRATE FD&C YELLOW NO. 6 ALUMINUM OXIDE E;HEART;81\" ], \"warnings\": [ \"Warnings Reye\u2019s syndrome: Children and teenagers who have or are recovering from chicken pox or flu-like symptoms should not use this product. When using this product, if changes in behavior with nausea and vomiting occur, consult a doctor because these symptoms could be an early sign of Reye\u2019s syndrome, a rare but serious illness. Allergy alert: Aspirin may cause a severe allergic reaction which may include: hives facial swelling asthma(wheezing) shock Stomach bleeding warning: This product contains a nonsteroidal anti-inflammatory drug (NSAID), which may cause stomach bleeding. The chance is higher if you: are age 60 or older have had stomach ulcers or bleeding problems take a blood thinning (anticoagulant) or steroid drug take other drugs containing prescription or nonprescription NSAIDs (aspirin, ibuprofen, naproxen, or others) have 3 or more alcoholic drinks every day while using this product take more or for a longer time than directed Do not use if you have ever had an allergic reaction to any other pain reliever/fever reducer Ask a doctor before use if stomach bleeding warning applies to you you have a history of stomach problems, such as heartburn you have high blood pressure, heart disease, liver cirrhosis, or kidney disease you are taking a diuretic you have asthma Ask a doctor or pharmacist before use if you are taking a prescription drug for: anticoagulation (thinning of the blood) gout diabetes arthritis Stop use and ask a doctor if you experience any of the following signs of stomach bleeding: feel faint vomit blood have bloody or black stools have stomach pain that does not get better allergic reaction occurs ringing in the ears or a loss of hearing occurs pain gets worse or lasts more than 10 days fever gets worse or lasts more than 3 days any new symptoms appear redness or swelling is present in the painful area If pregnant or breast- feeding, ask a health professional before use. It is especially important not to use aspirin during the last 3 months of pregnancy unless definitely directed to do so by a doctor because it may cause problems in the unborn child or complications during delivery. Keep out of reach of children In case of overdose, get medical help or contact a Poison Control Center right away.\" ] }, { \"set_id\": \"0125f400-6659-4ed9-aeb6-4116c7b0358c\", \"indications_and_usage\": [ \"\" ], \"stop_use\": [ \"Stop use and ask a doctor if- you experience any of the following signs of stomach bleeding- feel faint, have bloody or black stools, vomit blood, have stomach pain that does not get better, pain gets worse or lasts more than 10 days- fever gets worse or lasts more than 3 days - redness or swelling is present in the painful area - any new symptoms appear -ringing in the ears or a loss of hearing occurs Repackaged by Cardinal Health Zanesville, OH 43701 L4824082-10614 L4824082-20614\" ], \"ask_doctor\": [ \"Warnings Reye's syndrome: Children and teenagers who have or are recovering from chicken pox or flu-like symptoms should not use this product. When using this product, if changes in behavior with nausea and vomiting occur, consult a doctor because these symptoms could be an early sign of Reye's syndrome, a rare but serious illness\" ], \"keep_out_of_reach_of_children\": [ \"Keep out of the reach of children. In case of overdose, get medical help or contact a Poison Control Center right away. SKY Mfg. By: Time-Cap Labs 7 Michael Ave. Farmingdale, NY 11735 Dist. By: McKesson Packaging Services a business unit of McKesson Corporation 7101 Weddington Rd. Concord, NC 28027 *This product is not maufactured or distributed by Bayer Healthcare LLC, owner of the registered trademark Bayer\" ], \"dosage_and_administration\": [ \"Directions: drink a full glass of water with each dose; adults and children 12 years and over: take 4 to 8 tablets every 4 hours not to exceed 48 tablets in 24 hours unless directed by a doctor Children under 12 years - consult a doctor\" ], \"purpose\": [ \"Purpose Pain Reliever Uses- Temporarily relieves minor aches and pains- For other uses, see your doctor, but do not use for more than 10 days without consulting your doctor because serious side effects may occur.\" ], \"ask_doctor_or_pharmacist\": [ \"Ask a doctor or pharmacist before use if you are- taking a prescription drug for diabetes, gout, or arthritis- under a doctor's care for any serious condition- taking any other drug\" ], \"do_not_use\": [ \"Do not use if you are allergic to aspirin or any other pain reliever/ fever reducer Ask a doctor before use if you have - stomach bleeding waring applies to you - you have a history of stomach problems, such as heartburn - you have high blood pressure, heart disease, liver cirrhosis, or kidney disease- you are taking a diuretic, you have asthma- you have not been drinking fluids- you have lost a lot of fluid due to vomiting or diarrhea\" ], \"version\": \"4\", \"id\": \"e9791af2-bb5c-4b36-91e2-ab7b22914845\", \"pregnancy_or_breast_feeding\": [ \"WARNING: This package is intended for institutional use only. If pregnant or breast-feeding, ask a health professional before use. It is especially important not to use aspirin during the last 3 months of pregnancy unless definitely directed to do so by a doctor because it may cause problems in the unborn child or complications during delivery.\" ], \"package_label_principal_display_panel\": [ \"Principal Display Panel Aspirin Enteric Coated Tablets 81 mg 10 Tablets bag label\" ], \"active_ingredient\": [ \"Active Ingredient in Each tablet Aspirin 81 mg (NSAID*) *Non-steroidal anti-inflammatory drug\" ], \"inactive_ingredient\": [ \"Inactive ingredients: anhydrous lactose, carnauba wax, colloidal silicon dioxide, croscarmellose sodium, D&C yellow #10 aluminum lake, iron oxide ochre, methacrylic acid copolymer, microcrystalline cellulose, polysorbate 80, simethicone, sodium hydroxide, sodium lauryl sulfate, talc, titanium dioxide, triethyl citrate Storage: Store at 25C (77F) excursions permitted between 15-30C (59-86F) - use by expiration date on package\" ], \"@epoch\": 1415927453.475662, \"effective_time\": \"20140630\", \"openfda\": { \"unii\": [ \"R16CO5Y76E\" ], \"spl_id\": [ \"e9791af2-bb5c-4b36-91e2-ab7b22914845\" ], \"product_ndc\": [ \"55154-1493\" ], \"substance_name\": [ \"ASPIRIN\" ], \"rxcui\": [ \"308416\" ], \"spl_set_id\": [ \"0125f400-6659-4ed9-aeb6-4116c7b0358c\" ], \"original_packager_product_ndc\": [ \"63739-522\" ], \"product_type\": [ \"HUMAN OTC DRUG\" ], \"pharm_class_cs\": [ \"Nonsteroidal Anti-inflammatory Compounds [Chemical/Ingredient]\" ], \"upc\": [ \"0055154149303\" ], \"manufacturer_name\": [ \"Cardinal Health\" ], \"brand_name\": [ \"aspirin\" ], \"pharm_class_pe\": [ \"Decreased Prostaglandin Production [PE]\" ], \"route\": [ \"ORAL\" ], \"nui\": [ \"N0000000160\", \"N0000175721\", \"N0000008836\", \"N0000175722\" ], \"pharm_class_moa\": [ \"Cyclooxygenase Inhibitors [MoA]\" ], \"package_ndc\": [ \"55154-1493-0\" ], \"pharm_class_epc\": [ \"Nonsteroidal Anti-inflammatory Drug [EPC]\" ], \"generic_name\": [ \"ASPIRIN\" ], \"application_number\": [ \"part343\" ] }, \"spl_product_data_elements\": [ \"aspirin aspirin aspirin aspirin anhydrous lactose carnauba wax SILICON DIOXIDE croscarmellose sodium D&C YELLOW NO. 10 IRON METHACRYLIC ACID - ETHYL ACRYLATE COPOLYMER (1:1) TYPE A CELLULOSE, MICROCRYSTALLINE DIMETHICONE POLYSORBATE 80 SODIUM HYDROXIDE SODIUM LAURYL SULFATE TALC TITANIUM DIOXIDE triethyl citrate\" ], \"warnings\": [ \"Allergy alert: Aspirin may cause a severe allergic reaction which may include: hives, facial swelling, shock, asthma(wheezing) Stomach bleeding warning: This product contains an NSAID which may cause severe stomach bleeding. The chance is higher if you: are age 60 or older, have had stomach ulcers or bleeding problems, take a blood thinning (anticoagulant) or steroid drug, take other drugs containing prescription or non prescription NSAIDs (aspirin, ibuprofen, naproxen, or others), have 3 or more alcoholic drinks every day while using this product, take more or for a longer time than directed.\" ] } ]}"; FieldFinder finder = new FieldFinder( "unii" ); Set<String> res = finder.find( containsUniis ); assertEquals( res.size(), 1 ); assertTrue( "Expected R16CO5Y76E in unii list: " + res, res.contains( "R16CO5Y76E" )); } }