### Question:
LocalUserCondition implements Condition { @Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { boolean isLocalUserCondition = context .getEnvironment() .getProperty(EnvironmentPropertyNames.AUTH_MODE.getFullName()) .equals(AuthModes.LOCAL.getName()); return isLocalUserCondition; }  @Override boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata);  }### Answer:
@Test public void test_auth_mode_random_string_matches_should_be_false() { MockEnvironment environment = new MockEnvironment(); environment.setProperty("system.configuration.auth-mode", "123412531235"); BDDMockito.given(conditionContext.getEnvironment()).willReturn(environment); Assert.assertFalse(localUserCondition.matches(conditionContext, annotatedTypeMetadata)); }
@Test public void test_auth_mode_aad_matches_should_be_false() { MockEnvironment environment = new MockEnvironment(); environment.setProperty("system.configuration.auth-mode", "aad"); BDDMockito.given(conditionContext.getEnvironment()).willReturn(environment); Assert.assertFalse(localUserCondition.matches(conditionContext, annotatedTypeMetadata)); }
@Test public void test_auth_mode_local_matches_should_be_true() { MockEnvironment environment = new MockEnvironment(); environment.setProperty("system.configuration.auth-mode", "local"); BDDMockito.given(conditionContext.getEnvironment()).willReturn(environment); Assert.assertTrue(localUserCondition.matches(conditionContext, annotatedTypeMetadata)); }