Nutriments implements Serializable { @Nullable public Nutriment get(@NonNull String nutrimentName) { if (nutrimentName.isEmpty() || additionalProperties.get(nutrimentName) == null) { return null; } try { return new Nutriment(nutrimentName, additionalProperties.get(nutrimentName).toString(), get100g(nutrimentName), getServing(nutrimentName), getUnit(nutrimentName), getModifier(nutrimentName)); } catch (NullPointerException e) { String stacktrace = Log.getStackTraceString(e); Log.e("NUTRIMENTS-MODEL", stacktrace); return null; } }  @NonNull String getEnergyKjValue(final boolean isDataPerServing); @NonNull String getEnergyKcalValue(final boolean isDataPerServing); @Nullable Nutriment get(@NonNull String nutrimentName); @NonNull String getServing(String nutrimentName); @NonNull String get100g(String nutrimentName); @NonNull String getUnit(String nutrimentName); @NonNull String getModifier(String nutrimentName); String getModifierIfNotDefault(String nutrimentName); boolean contains(String nutrimentName); boolean hasVitamins(); boolean hasMinerals(); @JsonAnyGetter Map<String, Object> getAdditionalProperties(); @JsonAnySetter void setAdditionalProperty(String name, Object value); static final String DEFAULT_UNIT; static final String ENERGY_KCAL; static final String ENERGY_KJ; static final String ENERGY_FROM_FAT; static final String FAT; static final String SATURATED_FAT; static final String BUTYRIC_ACID; static final String CAPROIC_ACID; static final String CAPRYLIC_ACID; static final String CAPRIC_ACID; static final String LAURIC_ACID; static final String MYRISTIC_ACID; static final String PALMITIC_ACID; static final String STEARIC_ACID; static final String ARACHIDIC_ACID; static final String BEHENIC_ACID; static final String LIGNOCERIC_ACID; static final String CEROTIC_ACID; static final String MONTANIC_ACID; static final String MELISSIC_ACID; static final String MONOUNSATURATED_FAT; static final String POLYUNSATURATED_FAT; static final String OMEGA_3_FAT; static final String ALPHA_LINOLENIC_ACID; static final String EICOSAPENTAENOIC_ACID; static final String DOCOSAHEXAENOIC_ACID; static final String OMEGA_6_FAT; static final String LINOLEIC_ACID; static final String ARACHIDONIC_ACID; static final String GAMMA_LINOLENIC_ACID; static final String DIHOMO_GAMMA_LINOLENIC_ACID; static final String OMEGA_9_FAT; static final String OLEIC_ACID; static final String ELAIDIC_ACID; static final String GONDOIC_ACID; static final String MEAD_ACID; static final String ERUCIC_ACID; static final String NERVONIC_ACID; static final String TRANS_FAT; static final String CHOLESTEROL; static final String CARBOHYDRATES; static final String SUGARS; static final String SUCROSE; static final String GLUCOSE; static final String FRUCTOSE; static final String LACTOSE; static final String MALTOSE; static final String MALTODEXTRINS; static final String STARCH; static final String POLYOLS; static final String FIBER; static final String PROTEINS; static final String CASEIN; static final String SERUM_PROTEINS; static final String NUCLEOTIDES; static final String SALT; static final String SODIUM; static final String ALCOHOL; static final String VITAMIN_A; static final String BETA_CAROTENE; static final String VITAMIN_D; static final String VITAMIN_E; static final String VITAMIN_K; static final String VITAMIN_C; static final String VITAMIN_B1; static final String VITAMIN_B2; static final String VITAMIN_PP; static final String VITAMIN_B6; static final String VITAMIN_B9; static final String WATER_HARDNESS; static final String GLYCEMIC_INDEX; static final String NUTRITION_SCORE_UK; static final String NUTRITION_SCORE_FR; static final String CARBON_FOOTPRINT; static final String CHLOROPHYL; static final String COCOA; static final String COLLAGEN_MEAT_PROTEIN_RATIO; static final String FRUITS_VEGETABLES_NUTS; static final String PH; static final String TAURINE; static final String CAFFEINE; static final String IODINE; static final String MOLYBDENUM; static final String CHROMIUM; static final String SELENIUM; static final String FLUORIDE; static final String MANGANESE; static final String COPPER; static final String ZINC; static final String VITAMIN_B12; static final String BIOTIN; static final String PANTOTHENIC_ACID; static final String SILICA; static final String BICARBONATE; static final String POTASSIUM; static final String CHLORIDE; static final String CALCIUM; static final String PHOSPHORUS; static final String IRON; static final String MAGNESIUM; static final Map<String, Integer> MINERALS_MAP; static final Map<String, Integer> FAT_MAP; static final Map<String, Integer> CARBO_MAP; static final Map<String, Integer> PROT_MAP; static final Map<String, Integer> VITAMINS_MAP; }
@Test public void getNonExistentNutriment_returnsNull() { assertThat(nutriments.get("not there")).isNull(); }