I am tasked with testing several versions of a RestAPI. I thought of two ways to contain the set of valid rest calls. In the first case, I would have RestUrlFactory which contains a method that corresponds to each rest call. For example, I would have the methods:
public RestURL Version_1_1_PRODUCTS_GET();
public RestURL Version_1_1_PRODUCTS_PUT();
public RestURL Version_1_2_PRODUCTS_PRODUCT(int productId);
...etc
Alternatively, I figured I can have the RestUrlFactory contain an enumeration for each API Version. In which case, I would have an enum field for each rest call.
enum Version_1_1 implements RestUrl
{
PRODUCTS_GET("/products", "GET"),
PRODUCTS_PUT("TestProduct", "PUT"),
...
}
Or something of that nature. I think the latter option (using enums) is much cleaner. However, my question is if it is also good OOP Practice, and is it better in terms of performance? I figure using enumerations will result in the factory class taking up much less space.