### Question:
HasEntry implements GroupSelector, Configurable { public String select (long id, Serializable ser) { Context ctx = (Context) ser; String name = cfg.get ("name"); String action = ctx.get (name) != null ? YES : NO; return cfg.get (action, UNKNOWN); }  int prepare(long id, Serializable o); String select(long id, Serializable ser); void commit(long id, Serializable o); void abort(long id, Serializable o); void setConfiguration(Configuration cfg); static final String YES; static final String NO; static final String UNKNOWN; }### Answer:
@Test public void testSelect() { given(configuration.get("name")).willReturn("XYZtest"); given(context.get("XYZtest")).willReturn("someStuffs"); given(configuration.get("yes", "UNKNOWN")).willReturn("someStuffs"); String result = hasEntry.select(2L, context); assertThat(result, is("someStuffs")); }
@Test public void testSelectNo() { given(configuration.get("name")).willReturn("XYZtest"); given(context.get("XYZtest")).willReturn(null); given(configuration.get("no", "UNKNOWN")).willReturn("differentStuffs"); String result = hasEntry.select(3L, context); assertThat(result, is("differentStuffs")); }