<commit_before>/**
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 *
 * Copyright 2012-2015 the original author or authors.
 */
package org.assertj.core.util;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.util.introspection.Introspection.getProperty;

import java.beans.PropertyDescriptor;

import org.assertj.core.util.introspection.IntrospectionError;
import org.junit.Before;
import org.junit.Test;

public class Introspection_getProperty_Test {
  private Employee judy;

  @Before
  public void initData() {
    judy = new Employee(100000.0, 31);
  }

  @Test
  public void get_descriptor_for_property() {
    PropertyDescriptor propertyDescriptor = getProperty("age", judy);
    assertThat(propertyDescriptor).isNotNull();
    assertThat(propertyDescriptor.getName()).isEqualTo("age");
  }

  @Test
  public void should_raise_an_error_because_of_missing_getter() {
    try {
      getProperty("salary", judy);
    } catch (IntrospectionError error) {
      assertThat(error).hasMessage("No getter for property 'salary' in org.assertj.core.util.Employee");
    }
  }

  @Test
  public void should_raise_an_error_because_of_non_public_getter() {
    try {
      getProperty("company", judy);
    } catch (IntrospectionError error) {
      assertThat(error).hasMessage("No public getter for property 'company' in org.assertj.core.util.Employee");
    }
    try {
      getProperty("firstJob", judy);
    } catch (IntrospectionError error) {
      assertThat(error).hasMessage("No public getter for property 'firstJob' in org.assertj.core.util.Employee");
    }
  }

  @Test
  public void should_raise_an_error_because_of_non_public_getter_when_getter_is_in_superclass() {
    try {
      getProperty("name", new Example());
    } catch (IntrospectionError error) {
      assertThat(error).hasMessage("No public getter for property 'name' in org.assertj.core.util.Introspection_getProperty_Test$Example");
    }
  }

  public static class Example extends Super {
  }

  public static class Super {
    @SuppressWarnings("unused")
    private String getName() {
      return "a";
    }
  }
}<commit_msg>add missing fail calls to exception tests in Introspection_getProperty_Test<commit_after>/**
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 *
 * Copyright 2012-2015 the original author or authors.
 */
package org.assertj.core.util;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.assertj.core.util.introspection.Introspection.getProperty;

import java.beans.PropertyDescriptor;

import org.assertj.core.util.introspection.IntrospectionError;
import org.junit.Before;
import org.junit.Test;

public class Introspection_getProperty_Test {
  private Employee judy;

  @Before
  public void initData() {
    judy = new Employee(100000.0, 31);
  }

  @Test
  public void get_descriptor_for_property() {
    PropertyDescriptor propertyDescriptor = getProperty("age", judy);
    assertThat(propertyDescriptor).isNotNull();
    assertThat(propertyDescriptor.getName()).isEqualTo("age");
  }

  @Test
  public void should_raise_an_error_because_of_missing_getter() {
    try {
      getProperty("salary", judy);
      fail("IntrospectionError expected");
    } catch (IntrospectionError error) {
      assertThat(error).hasMessage("No getter for property 'salary' in org.assertj.core.util.Employee");
    }
  }

  @Test
  public void should_raise_an_error_because_of_non_public_getter() {
    try {
      getProperty("company", judy);
      fail("IntrospectionError expected");
    } catch (IntrospectionError error) {
      assertThat(error).hasMessage("No public getter for property 'company' in org.assertj.core.util.Employee");
    }
    try {
      getProperty("firstJob", judy);
      fail("IntrospectionError expected");
    } catch (IntrospectionError error) {
      assertThat(error).hasMessage("No public getter for property 'firstJob' in org.assertj.core.util.Employee");
    }
  }

  @Test
  public void should_raise_an_error_because_of_non_public_getter_when_getter_is_in_superclass() {
    try {
      getProperty("name", new Example());
      fail("IntrospectionError expected");
    } catch (IntrospectionError error) {
      assertThat(error).hasMessage("No public getter for property 'name' in org.assertj.core.util.Introspection_getProperty_Test$Example");
    }
  }

  public static class Example extends Super {
  }

  public static class Super {
    @SuppressWarnings("unused")
    private String getName() {
      return "a";
    }
  }
}
{'fraction_non_alphanumeric': 0.09694793536804308, 'fraction_numerical': 0.0075403949730700175, 'mean_word_length': 4.182325581395349, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7322566', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1601, 'n_words': 439}