RequestOperator implements RequestObject { public static RequestOperator of(String operator) { return of(OperatorType.fromString(operator)); } private  RequestOperator(OperatorType operator); static RequestOperator of(String operator); static RequestOperator of(OperatorType operatorType); OperatorType getOperator(); @Override RequestObjectType getType(); @Override String toString(); @Override final boolean equals(Object obj); @Override final int hashCode();  }
@Test(expected = IllegalArgumentException.class) public void testOfMethodShouldFailWhenIncorrectOperatorSpecified() throws Exception { RequestOperator requestOperator = RequestOperator.of("wrongLogicalOperator"); }
@Test public void testTwoDifferentObjectsEqualsWhenSameNameGiven() throws Exception { RequestOperator requestOperator = RequestOperator.of("$eq"); assertThat(requestOperator).isEqualTo(RequestOperator.of("$eq")); }
@Test public void testTwoObjectsAreNotEqualWhenDifferentNames() throws Exception { RequestOperator requestOperator = RequestOperator.of("$eq"); assertThat(requestOperator).isNotEqualTo(RequestOperator.of("$startsWith")); }